#27682 [NEW]: bug with mysql_escape_string and linefeeds
| From: | ckrack at i-z dot de | Date: | Wed, 24 Mar 2004 22:52:13 +0000 |
| Subject: | #27682 [NEW]: bug with mysql_escape_string and linefeeds | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-56781@lists.php.net to get a copy of this message | ||
From: ckrack at i-z dot de
Operating system: Windows NT 5.0 build 219 (win2k)
PHP version: 4.3.4
PHP Bug Type: Strings related
Bug description: bug with mysql_escape_string and linefeeds
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 bug report at http://bugs.php.net/?id=27682&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27682&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27682&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27682&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27682&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27682&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27682&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27682&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27682&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27682&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27682&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27682&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27682&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27682&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27682&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27682&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27682&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27682&r=float