#27682 [Opn->Bgs]: bug with mysql_escape_string and linefeeds
| From: | georg@php.net | Date: | Thu, 25 Mar 2004 06:21:46 +0000 |
| Subject: | #27682 [Opn->Bgs]: bug with mysql_escape_string and linefeeds | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56790@lists.php.net to get a copy of this message | ||
ID: 27682
Updated by: georg@php.net
Reported By: ckrack at i-z dot de
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: Windows NT 5.0 build 219 (win2k)
PHP Version: 4.3.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
stripslashes unquotes a string which was quoted with
addslahes not with mysql_escape_string.
Please reread documentation at http://www.php.net/manual/
en/function.stripslashes.php
Previous Comments:
------------------------------------------------------------------------
[2004-03-24 17:52:13] ckrack at i-z dot de
Description:
------------
I'm experiencing a problem when saving data in db.
i use mysql_escape_string() to escape the string for safe db storage.
when i use stripslashes() to remove the slashes, and then nl2br(), my
linebreaks don't get converted to <br /> 's.
this is due to stripslashes().
Reproduce code:
---------------
<?php
// error
$str = "string with specialchars fo'o'bar's and line \r\n \nfeeds";
$str = mysql_escape_string($str);
$str = stripslashes($str);
echo $str;
?>
Expected result:
----------------
string with specialchars fo'o'bar's and line
feeds
(there are linefeeds as you can see)
Actual result:
--------------
string with specialchars fo'o'bar's and line rn nfeeds
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27682&edit=1