#36812 [Opn->Bgs]: bind NULL variables generates warning
| From: | iliaa@php.net | Date: | Wed, 22 Mar 2006 17:19:32 +0000 |
| Subject: | #36812 [Opn->Bgs]: bind NULL variables generates warning | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94769@lists.php.net to get a copy of this message | ||
ID: 36812
Updated by: iliaa@php.net
Reported By: ce at netage dot bg
-Status: Open
+Status: Bogus
Bug Type: PostgreSQL related
Operating System: linux
PHP Version: 5.1.3RC1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You declare the parameter is being of type INT and then put NULL into
it. Is it any wonder PostgreSQL generates an error?
Previous Comments:
------------------------------------------------------------------------
[2006-03-21 12:38:16] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36812&edit=1