0

Possible Duplicate:
PHP session variables interchanged with local variables?

Well, I just found a "bug" in PHP, it just mess up $_SESSION and common variables!

session_start();

$_SESSION["test"] = 123;
$test = 456;

echo $_SESSION["test"];

for some reason, the output of this snippet is 456! is it ok or is just a php bug?

Community
  • 1
  • 1
Pedro Papadópolis
  • 402
  • 1
  • 3
  • 10
  • 7
    You probably have `register_globals` on, upgrade your PHP version. – kittycat Jan 07 '13 at 04:00
  • possible duplicate of [PHP session variables interchanged with local variables?](http://stackoverflow.com/questions/3779971/php-session-variables-interchanged-with-local-variables) , http://stackoverflow.com/questions/9097068/php-session-variables-randomly-get-overwritten?rq=1 , http://stackoverflow.com/questions/10411134/php-array-stored-in-session-is-set-to-null-if-we-initialise-a-array-with-same-wi?rq=1 , http://stackoverflow.com/questions/11943608/asigning-value-to-a-variable-changes-session-too?rq=1 –  Jan 07 '13 at 04:07
  • 1
    Checkout this link It will help you to understand concept of [register_globals ][1] [1]: http://stackoverflow.com/questions/3593210/what-are-register-globals-in-php – Hemantwagh07 Jan 07 '13 at 04:08

0 Answers0