|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #36874 PDO_PGSQL quote null change
Submitted: 2006-03-27 16:27 UTC Modified: 2013-12-30 04:21 UTC
Avg. Score:4.3 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (20.0%)
From: stochnagara at hotmail dot com Assigned: willfitch (profile)
Status: Wont fix Package: PDO related
PHP Version: 5.1.3RC1 OS: win xp
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-03-27 16:27 UTC] stochnagara at hotmail dot com
Currently PDO quotes null value as a string '' . I suggest to change this behaviour and quote null as sql NULL.

Reproduce code:
$pdo = new PDO('pgsql:...', 'root', '');
var_dump ($pdo->quote (null));

Expected result:

Actual result:
string ('')


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 23:22 UTC]
-Package: Feature/Change Request +Package: PDO related
 [2013-06-12 02:09 UTC]
-Summary: PDO quote null change +Summary: PDO_PGSQL quote null change
 [2013-10-29 18:56 UTC]
-Assigned To: +Assigned To: willfitch
 [2013-10-29 19:09 UTC]
The issue with the specific case is that PDO converts the NULL to an empty string prior to pdo_pgsql has the opportunity to analyze it.  In pgsql_handle_quoter, the unquoted value is an empty string.  

I'll look at the impact this would have on other drivers to pass NULL and PDO_PARAM_NULL for paramtype.
 [2013-11-04 22:28 UTC]
The only way we'll be able to implement this feature is to change the quote function at the PDO layer to accept a zval.  However, this will require changes in each of the drivers.
 [2013-12-30 04:21 UTC]
-Status: Assigned +Status: Wont fix
 [2013-12-30 04:21 UTC]
Going to close this for now.  I would suggest a full-blown RFC for this change.  This would affect every driver under PDO, and it outside of the scope of pgsql.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 07:01:31 2024 UTC