bind NULL variables generates warning
| Bug #36812 | bind NULL variables generates warning | ||||
|---|---|---|---|---|---|
| Submitted: | 2006-03-21 12:38 UTC | Modified: | 2006-11-13 22:11 UTC | ||
| From: | ce at netage dot bg | Assigned: | |||
| Status: | Closed | Package: | PostgreSQL related | ||
| PHP Version: | 5.1.3RC1 | OS: | linux | ||
| Private report: | No | CVE-ID: | None | ||
[2006-03-21 12:38 UTC] ce at netage dot bg
Description:
------------
when binding explicit null value there is no problem (see the workarround), but, when the null value is from variable there is a problem (the example is stupid, but is the simplest one representing the problem)
Reproduce code:
---------------
CREATE TABLE nullproblem (i integer);
<?
$conn = pg_connect('dbname=test');
$temp1 = null;
$param_list = array($temp1, $temp1, $temp1, );
/*******************
workarround:
$param_list = array(is_null($temp1)?null:$temp1, is_null($temp1)?null:$temp1, is_null($temp1)?null:$temp1, );
****************/
pg_prepare($conn, 'test', 'INSERT INTO nullproblem VALUES (case when $2::int IS NULL then $3::int else $1::int end)');
pg_execute($conn, 'test', $param_list);
?>
Expected result:
----------------
nothing special
Actual result:
--------------
Warning: pg_execute(): Query failed: ERROR: invalid input syntax for integer: "" in test.php on line 10
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-03-22 18:19 UTC] iliaa@php.net
[2006-03-23 09:58 UTC] ce at netage dot bg
[2006-11-11 14:16 UTC] dave@php.net
[2006-11-13 22:11 UTC] iliaa@php.net