|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36606 Variables with null values change to empty string after pg_query_params
Submitted: 2006-03-03 15:44 UTC Modified: 2006-03-05 14:35 UTC
From: everton at faccat dot br Assigned: helly (profile)
Status: Closed Package: PostgreSQL related
PHP Version: 5.1.2 OS: Linux Slackware 9.1
Private report: No CVE-ID: None
 [2006-03-03 15:44 UTC] everton at faccat dot br
Variables with null values change to an empty string after pg_query_params. This is not reported in pg_query_params manual.

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

Expected result:

Actual result:
string(0) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-03 21:43 UTC] everton at faccat dot br
category updated
 [2006-03-05 14:02 UTC]
Marcus, please take a look at it.
From what I can see, there is no sense in converting params to string as long as we don't support OUT parameters (?).

So this extremely short patch fixes it:

@@ -1257,7 +1257,7 @@ PHP_FUNCTION(pg_query_params)

                        otype = (*tmp)->type;
-                       convert_to_string(*tmp);
+                       convert_to_string_ex(tmp);
                        if (Z_TYPE_PP(tmp) != IS_STRING) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
                                _php_pgsql_free_params(params, num_params);
 [2006-03-05 14:35 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 00:01:02 2019 UTC