php.net |  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
Votes:7
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
 [2006-03-27 16:27 UTC] stochnagara at hotmail dot com
Description:
------------
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:
----------------
null

Actual result:
--------------
string ('')

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 23:22 UTC] jani@php.net
-Package: Feature/Change Request +Package: PDO related
 [2013-06-12 02:09 UTC] ssufficool@php.net
-Summary: PDO quote null change +Summary: PDO_PGSQL quote null change
 [2013-10-29 18:56 UTC] willfitch@php.net
-Assigned To: +Assigned To: willfitch
 [2013-10-29 19:09 UTC] willfitch@php.net
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] willfitch@php.net
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] willfitch@php.net
-Status: Assigned +Status: Wont fix
 [2013-12-30 04:21 UTC] willfitch@php.net
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: Thu Dec 26 13:01:30 2024 UTC