Nasty PHP 4.4 Bug in Session Data

By Angsuman Chakraborty, Gaea News Network
Friday, November 3, 2006

We deployed an application on client site yesterday and we faced a really puzzling problem. Some data stored in session variable ( $_SESSION["messages"] ) was returning the data of a global array $messages. Before deploying we thoroughly tested the project on multiple PHP installations, both on out intranet and on the web. We never encountered this PHP bug.

The problem was truly baffling. I could see what was happening but I couldn’t see where it was happening; the assignment of $messages to $_SESSION['messages']. On a hunch I changed messages to smessages and the problem was solved. In other words, I simply renamed the key for the data stored in session ( $_SESSION["smessages"] ).

I found the clients site is using PHP 4.4. Other than that everything is normal. This is a pretty weird defect that you should be aware of when deploying to 4.4 (and who knows where else).

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :