[PHP-DEV] PHP 4.0 Bug #5953 Updated: Session invalidates when newline character is inserted into a session variable From: Bug Database (php-dev <email protected>)
Date: 08/04/00

ID: 5953
User Update by: mbeers <email protected>
Status: Open
Bug Type: Session related
Description: Session invalidates when newline character is inserted into a session variable

Here is some sample code to reproduce the problem:
<?
session_start();
session_register("beforeLF");
session_register("testVarLF");
session_register("testVarNoLF");

$beforeLF = "A string before that with linefeeds";
$testVarNoLF = "A string without linefeeds";
$testVarLF = "A string with linefeeds\nmore\nmore\n";

print "click <a href=\"test2.php\">here</a> to continue<br><br>";
?>
beforeLF:
<pre><?= $beforeLF ?></pre>
end;
<br><br>
testVarLF:
<pre><?= $testVarLF ?></pre>
end;
<br><br>
testVarNoLF:
<pre><?= $testVarNoLF ?></pre>
end;

in another file (in this case called test2.php):
<?
session_start();
?>
beforeLF:
<pre><?= $beforeLF ?></pre>
end;
<br><br>
testVarLF:
<pre><?= $testVar ?></pre>
end of the output of the testVar
<br><br>
testVarNoLF:
<pre><?= $testVarNoLF ?></pre>
end;

On my system, the variables don't print out at all. However, if you comment out the $testVarLF variable in the first file, everything comes out fine. (except of course a value for that variable, because it is not set). Also, if you change it to not include newline characters, it works.

Full Bug description available at: http://bugs.php.net/?id=5953

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>