PHP 4.0 Bug #5953: Session invalidates when newline character is inserted into a session variable
| From: | mbeers at udeco dot com | Date: | Fri, 04 Aug 2000 06:09:00 +0000 |
| Subject: | PHP 4.0 Bug #5953: Session invalidates when newline character is inserted into a session variable | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-27607@lists.php.net to get a copy of this message | ||
From: mbeers@udeco.com
Operating system: Windows 2000
PHP version: 4.0.1pl2
PHP Bug Type: Session related
Bug description: Session invalidates when newline character is inserted into a session variable
If you take a form with a textfield on it and enter some text, including hit enter a couple of
times, and store that information in a session variable, when you later try to access that variable
(or any variables registered after that one) it is invalidated.
It seems that when the session file is created, the newline character creates a second line (on
win32 anyway) and I suppose that the code that reads the encoded session reads a line at a time,
thereby missing the second line of information and invalidating any variables occurring after the
one with newline charaters in it. We worked around this particular problem by replacing \n with
another character, and this kept the session intact. (Please note that the \r character remained in
the string, but win32 of course does not recognize that as eol)
This was only tested on IE5, but not Netscape or earlier versions of IE.