php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25439 $dbh->quoteString returns NULL
Submitted: 2003-09-08 16:49 UTC Modified: 2004-01-22 14:13 UTC
From: jeremy at deadbeef dot com Assigned: danielc (profile)
Status: Not a bug Package: PEAR related
PHP Version: 4.3.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jeremy at deadbeef dot com
New email:
PHP Version: OS:

 

 [2003-09-08 16:49 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-22 14:13 UTC] danielc@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Feb 16 06:01:30 2025 UTC