php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46206 pg_query_params modifies null values in array to empty strings
Submitted: 2008-10-01 01:25 UTC Modified: 2008-10-01 20:31 UTC
From: pierre dot dumuid at adelaide dot edu dot au Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID:
 [2008-10-01 01:25 UTC] pierre dot dumuid at adelaide dot edu dot au
Description:
------------
pg_query_params modifies null values in array to empty strings.

(similar, but different to bug #36606, I can verify that #36606 is fixed for me!)


Reproduce code:
---------------
// createdb saga3; 
// echo 'CREATE TABLE pais (idpais integer);' | psql saga3

$a = pg_connect("dbname=saga3");
$b = array(null);
var_dump($b); 
pg_query_params($a, "SELECT * FROM pais WHERE idpais = $1", $b);
var_dump($b); 
die;

Expected result:
----------------
array(1) {
  [0]=>
  NULL
}
array(1) {
  [0]=>
  NULL
}

Actual result:
--------------
array(1) {
  [0]=>
  NULL
}
array(1) {
  [0]=>
  string(0) ""
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-01 20:31 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 01:01:56 2014 UTC