Menu

#70 PHP arrays

v1.0 (example)
closed
None
5
2011-08-30
2011-01-20
Benjam
No

In the config file (and possibly elsewhere, I haven't looked) the array keys are not wrapped in quotes.

$CFG_TABLE[communication] = "communication";
$CFG_TABLE[games] = "games";
$CFG_TABLE[history] = "history";
$CFG_TABLE[messages] = "messages";
$CFG_TABLE[pieces] = "pieces";
$CFG_TABLE[players] = "players";
$CFG_TABLE[preferences] = "preferences";

should be written as:

$CFG_TABLE['communication'] = "communication";
$CFG_TABLE['games'] = "games";
$CFG_TABLE['history'] = "history";
$CFG_TABLE['messages'] = "messages";
$CFG_TABLE['pieces'] = "pieces";
$CFG_TABLE['players'] = "players";
$CFG_TABLE['preferences'] = "preferences";

any array key not wrapped in quotes is assumed by PHP to be a constant, which is not correct. Although the code eventually works, it throws errors.

Discussion

  • Rodrigo Flores

    Rodrigo Flores - 2011-08-30

    Fixed on BZR.

     
  • Rodrigo Flores

    Rodrigo Flores - 2011-08-30
    • assigned_to: nobody --> roflo1
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB