5

Possible Duplicate:
can I get PHP to stop replacing ‘.’ characters in $_GET or $_POST arrays?

So I am writing a simple long polling test application and in an effort to weed out all bugs I just went straight to the processing page in the browser and pre'd out all the content to see what's going on and here's what I've come up with... I go to url...

localhost/long_polling/poll.php?user.user1=logged_in&user.user2=logged_out&user.user3=logged_out

the first line of my php code in poll.php (for testing) is

echo "<pre>";
print_r($_REQUEST);
echo "</pre>";

what that outputs is

Array
    (
    [user_user1] => logged_in
    [user_user2] => logged_out
    [user_user3] => logged_out
    )

Does anyone have any idea why it is replacing the "."'s in the usernames with "_"? All of my usernames in the database are firstname.lastname so this whole thing is failing. If this is just default php behavior, though TERRIBLE, is there a better solution than using something like...

foreach($_REQUEST as $key => $value) {
    $statuses[str_replace('_', '.', $key)] = $value;
}

I just don't like that, because what if something uses this later and actually has the "_" in it.

Thank you for the help in advance

Community
  • 1
  • 1
Rob
  • 237
  • 2
  • 9

0 Answers0