#37011 [NEW]: I need autoescape fot mysql code

From: Date: Fri, 07 Apr 2006 16:56:49 +0000
Subject: #37011 [NEW]: I need autoescape fot mysql code
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95438@lists.php.net to get a copy of this message
From: kpoxa at kpoxa dot net Operating system: Any PHP version: 4.4.2 PHP Bug Type: Feature/Change Request Bug description: I need autoescape fot mysql code Description: ------------ In perl+mysql qyury params may by autoescaped, in php i must user mysql_escape_string, wy not exists function like this: use $ecaped_query = mysql_make_query("select * from table where id=? and field2=? ORDER BY ID",1,'Here i may savely put any data this " and over untrusted symbols'); Reproduce code: --------------- function mysql_make_query() { $num_args = func_num_args(); if ($num_args==0) return ''; $format = func_get_arg(0); if ($num_args==1) return $format; $strings = explode('?',$format); $result = array_shift($strings); for ($i=1;$i<$num_args;$i++) { $result .= "'".mysql_escape_string(func_get_arg($i))."'";//'" $result .= array_shift($strings); } return $result; } -- Edit bug report at http://bugs.php.net/?id=37011&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37011&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37011&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37011&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37011&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37011&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37011&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37011&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37011&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37011&r=support Expected behavior: http://bugs.php.net/fix.php?id=37011&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37011&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37011&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37011&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37011&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37011&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37011&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37011&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37011&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37011&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37011&r=mysqlcfg

« previous php.bugs (#95438) next »