minor bug in DB

From: Date: Tue, 13 Aug 2002 20:38:02 +0000
Subject: minor bug in DB
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-8406@lists.php.net to get a copy of this message
The MySQL backend of DB uses mysql_escape_string() to escape special characters. This function is deprecated in 4.3.0-dev in favor of mysql_real_escape_string and prints a notice. The following patch fixes the problem. I don't know if this is the right way and the 'PEAR-way' to fix this, so I'm posting it here instead of committing it. --- mysql.php 31 Jul 2002 12:02:40 -0000 1.7 +++ mysql.php 13 Aug 2002 20:27:43 -0000 @@ -668,7 +668,11 @@ return $str; case 'string': default: - return "'".mysql_escape_string($str)."'"; + if(function_exists('mysql_real_escape_string')) { + return "'".mysql_real_escape_string($str)."'"; + } else { + return "'".mysql_escape_string($str)."'"; + } } } Comments please. Sander

« previous php.pear.dev (#8406) next »