From: ce at netage dot bg
Operating system: linux
PHP version: 5.1.3RC1
PHP Bug Type: PostgreSQL related
Bug description: bind NULL variables generates warning
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 bug report at http://bugs.php.net/?id=36812&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36812&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36812&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36812&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36812&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36812&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36812&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36812&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36812&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36812&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36812&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36812&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36812&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36812&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36812&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36812&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36812&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36812&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36812&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36812&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36812&r=mysqlcfg