#25439 [NEW]: $dbh->quoteString returns NULL
| From: | jeremy at deadbeef dot com | Date: | Mon, 08 Sep 2003 20:49:54 +0000 |
| Subject: | #25439 [NEW]: $dbh->quoteString returns NULL | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-21210@lists.php.net to get a copy of this message | ||
From: jeremy at deadbeef dot com
Operating system: Linux
PHP version: 4.3.3
PHP Bug Type: PEAR related
Bug description: $dbh->quoteString returns NULL
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 bug report at http://bugs.php.net/?id=25439&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25439&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25439&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25439&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25439&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25439&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25439&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25439&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25439&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25439&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25439&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25439&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25439&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25439&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25439&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25439&r=gnused