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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Tue Feb 18 01:01:26 2020 UTC