Forum Moderators: coopster
So say I put some data into a session field from a textarea:
This is session data. There are line breaks and 'quotes' Now, when I want to use that session data on another page, the resulting data is slightly confusing:
If magic quotes is on, the results are as expected:
echo '<pre>';
print_r($_SESSION['myvar']);
echo '</pre>';
This is session data.There are line breaks and \'quotes\'
Notice that the line breaks are preserved.
However, if magic quotes are off, the line breaks are not preserved:
This is session data.\r\n\r\nThere are line breaks and \'quotes\'
My issue is that nl2br does not work on the \r\n values.
Has anyone else run into this issue, or have a fix?
(str_replace('\r\n', '<br />', $value) works on this, but seems more like a kludge than anything ...)
Thanks!
-Sned
From PHP.net
This feature has been DEPRECATED and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.
There are no comments on the PHP site about magic quotes causing line break issues with nl2br. Are you running the code through any other functions?
dc