#30424 [NEW]: mysql_real_escape_string fails to escape a"b`c'd/e\f right

From: Date: Wed, 13 Oct 2004 19:42:47 +0000
Subject: #30424 [NEW]: mysql_real_escape_string fails to escape a"b`c'd/e\f right
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67546@lists.php.net to get a copy of this message
From: tomer at ivrit dot org dot il Operating system: Linux PHP version: 5.0.1 PHP Bug Type: MySQL related Bug description: mysql_real_escape_string fails to escape a"b`c'd/e\f right Description: ------------ It seems that mysql_real_escape_string fails to escape the string 'a"b`c'd/e\f' (without the surrounding quotes) right.. Reproduce code: --------------- While magic_quotes_gpc are off and submitting on a POST form: a"b`c'd/e\f $query = sprintf("UPDATE tbl SET field='%s'", mysql_real_escape_string($_POST['name'])); $result = mysql_query($query); Expected result: ---------------- The mysql_error() will be a syntax error of course.. Actual result: -------------- You have an error in your SQL syntax near 'd/e\f', ... -- Edit bug report at http://bugs.php.net/?id=30424&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30424&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30424&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30424&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30424&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30424&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30424&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30424&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30424&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30424&r=support Expected behavior: http://bugs.php.net/fix.php?id=30424&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30424&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30424&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30424&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30424&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30424&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30424&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30424&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30424&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30424&r=mysqlcfg

« previous php.bugs (#67546) next »