Are you, in fact, a pregnant lady who lives in the apartment next door to Superdeath's parents? - Commodore

Create an account  

 
How to set up a PBEM tracker

That's just a warning saying you didn't initialize a variable before using it. PHP generally has tons of those warnings due to lack of language rigor which leads to laziness causing such warnings. Your error settings may have been set to not show warnings before, and now it shows warnings, or maybe your PHP version got upgraded which increased the number of warnings generated on old style code.
Reply

This is a newer version of PHP so I bet that's it. I'll try to go in tomorrow and tweak the code and see if that gets rid of those. smile Thanks!
Reply

Yeah I'd guess your PHP version was upgraded from 5.3 to 5.4. (PHP 5.3 is the longest-lived version even though newer versions have been available for years now.) You can try looking for the first instance of $index and inserting this into the line before:

Code:
$index = new stdClass();

Reference: http://stackoverflow.com/questions/89007...lue-in-php
Reply

Still can't see what exactly the problem is. duh

Here's the relevant part of the code generating the error, the last line is the one it is giving these errors on:

Code:
private function read_tracker_file ( $file )
        {
            $handle = fopen ( $file , "rt" );
            
            while ( $buffer = fgets ( $handle ) )
            {
                if ( $buffer [ 0 ] != '#' )
                    continue;
                $buffer = explode ( "#" , $buffer );
                $buffer [ 1 ] = ltrim ( rtrim ( $buffer [ 1 ] ) );
                if ( $buffer [ 1 ] == "Mailbox" )
                {
                    $var_type = "mailbox";
                    continue;
                }
                if ( $buffer [ 1 ] == "Game" )
                {
                    $var_type = "game";
                    continue;
                }
                if ( $buffer [ 1 ] == "Players" )
                {
                    $var_type = "players";
                    continue;
                }
                $var = explode ( "::" , $buffer [ 1 ] );
                $var [ 0 ] = ltrim ( rtrim ( $var [ 0 ] ) );
                $var [ 1 ] = ltrim ( rtrim ( $var [ 1 ] ) );
                if ( $var [ 0 ] == "turn_order" )
                {
                    $slot = $var [ 1 ];
                    if ( !isset ( $this -> $var_type -> side [ $slot ] [ 0 ] ) )
                        $this -> $var_type -> side [ $slot ] = array () ;
                }
                else if ( $var [ 0 ] == "name" )
                    $name = $var [ 1 ];
                else if ( $var [ 0 ] == "email" )
                {
                    $player = new Player ( $slot , $name , $var [ 1 ] );
                    array_push ( $this -> $var_type -> side [ $slot ] , $player );
                }
                else
                    $this -> $var_type -> $var [ 0 ] = $var [ 1 ];
            }

Here's a tracker file it's giving the error on:

Code:
#Mailbox

#imap_server    ::    imap.gmail.com
#imap_port        ::    993
#smtp_server    ::    smtp.gmail.com
#smtp_port        ::    465
#account        ::    [redacted]
#password        ::    [redacted]
#flags            ::    /ssl/novalidate-cert

#Game

#gamename        ::    Crowd
#flavor            ::    bts

#Players

#turn_order        ::    0
#name            ::    Sinimusta
#email            ::    [redacted]

#turn_order        ::    1
#name            ::    RuffHi
#email            ::    [redacted]

#turn_order        ::    2
#name            ::    Knoedel
#email            ::    [redacted]

#turn_order        ::    3
#name            ::    Hercules
#email            ::    [redacted]

I thought it was $var_type being hit before it got to one of the 3 definitions, but that doesn't make sense in context of the contents of the .tracker file. And I went ahead and defined it at the beginning of the function anyway, to no effect.
Reply

Sorry, what? Are we talking about the same warning/error? I am just going by the message Ruff posted. I checked the tracker file posted by novice in the beginning of the thread and that is not the line generating the error at all.

Anyway, according to that code the object not being initialized is probably $this. There are already lines initializing $var_type as a string.
Reply

That file isn't current, that was the first version of the tracker, the current one is in Mist's post #11 in the thread. And I thnk that's the line that's causing the error because that's line 284 which is the line the errors are pointing to.
Reply

There's obviously an issue parsing the .tracker file. I would check for extraneous whitespace in it, and encoding issues. And anything else that might differ from a "healthy" tracker file.
I have to run.
Reply

I used notepad to edit the tracker. I did insert a tab in both of the _port lines to get them to line up.

The error occurs twice ... could it be those 'new' tabs?
I have finally decided to put down some cash and register a website. It is www.ruffhi.com. Now I remain free to move the hosting options without having to change the name of the site.

(October 22nd, 2014, 10:52)Caledorn Wrote: And ruff is officially banned from playing in my games as a reward for ruining my big surprise by posting silly and correct theories in the PB18 tech thread.
Reply

Are there any other games tracked on the server right now? If those aren't giving errors then yes, it has to be something wrong with the tracker file for the game specifically.
Reply

Similar errors on EitB 47 tracker:

Code:
Warning: Creating default object from empty value in /home/brickastley/realmsbeyond.net/pbem/tracker.php on line 284

Warning: Creating default object from empty value in /home/brickastley/realmsbeyond.net/pbem/tracker.php on line 284

But it's showing who has the save again, so I can live with some cosmetic problems. Thanks for the prompt fix, BRick!
Reply



Forum Jump: