#25439 [Opn->Bgs]: $dbh->quoteString returns NULL

From: Date: Thu, 22 Jan 2004 19:13:28 +0000
Subject: #25439 [Opn->Bgs]: $dbh->quoteString returns NULL
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-25227@lists.php.net to get a copy of this message
ID: 25439 Updated by: danielc@php.net Reported By: jeremy at deadbeef dot com -Status: Open +Status: Bogus Bug Type: PEAR related Operating System: Linux PHP Version: 4.3.3 -Assigned To: +Assigned To: danielc New Comment: quoteString() has been depricated since release 1.2 or even earlier. CVS commits made earlier today introduced new quoting methods: quoteSmart() and escapeSimple() and depricated the quote() method. Previous Comments: ------------------------------------------------------------------------ [2003-09-08 16:49:54] jeremy at deadbeef dot com Description: ------------ In the PEAR DB module, the quoteString function returns the string "NULL" when passed a null. This makes a literal "NULL" get written into the database which is a problem. For better backwards compatibility with the pre-quote() API please consider this implementation for pear/DB/common.php: function quoteString($string) { $string = $this->quote($string); if ($string == "NULL") return ""; if ($string{0} == "'") { return substr($string, 1, -1); } return $string; } Reproduce code: --------------- $val=$dbh->getOne("select null"); echo "The value is:", $dbh->quote($val); Expected result: ---------------- The value is: Actual result: -------------- The value is:NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25439&edit=1

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