Edit report at https://bugs.php.net/bug.php?id=62024&edit=1
ID: 62024 Updated by: mbecc...@php.net Reported by: matheus at gigatron dot com dot br Summary: Cannot insert second row with null using parametrized query (Firebird PDO) -Status: Open +Status: Closed Type: Bug Package: PDO related Operating System: Windows 7 PHP Version: 5.4.3 Block user comment: N Private report: N New Comment: Automatic comment on behalf of math...@gigatron.com.br Revision: http://git.php.net/?p=php-src.git;a=commit;h=df6ca450ce1bebb7a36c0d2eecb51a28ac2f5118 Log: Fixed bug #62024 (unable to run consecutive prepared querys with null values) Previous Comments: ------------------------------------------------------------------------ [2013-03-21 19:05:18] matheus at gigatron dot com dot br I can confirm James' patch indeed seems to solve the problem (at least for this reproducible test script). Would be nice if a developer could include this on the master php branch. ------------------------------------------------------------------------ [2012-05-27 10:59:42] mr dot efrem at gmail dot com This problem is observed still in php5-5.3.13. ------------------------------------------------------------------------ [2012-05-14 13:35:08] matheus at gigatron dot com dot br Description: ------------ Using the firebird PDO driver and a parametrized insert query, you cannot use a null value for a column after issuing a query with a filled value for that same column. On the snipped below, it should be possible to insert both rows, but the second one fails with an exception. If you invert the order of the inserts (insert $args_err before $args_ok) then the script runs. Test script: --------------- /**Reference table: CREATE TABLE TEST_INSERT ( ID INTEGER NOT NULL, COL1 VARCHAR(40) ); */ $sql = "insert into test_insert (id, col1) values (?, ?);" $args_ok = [1, "test1"]; $args_err = [2, null]; $res = $stmt->execute($args_ok); var_dump($res); $res = $stmt->execute($args_err); var_dump($res); Expected result: ---------------- bool(true) bool(true) Actual result: -------------- bool(true) PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY105 ]: Invalid parameter type: -999 Parameter requires non-null value' in F:\demos\p hp\erro_insert_prep_null\test.php:42 Stack trace: #0 F:\demos\php\erro_insert_prep_null\test.php(42): PDOStatement->execute(Array) #1 {main} thrown in F:\demos\php\erro_insert_prep_null\test.php on line 42 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62024&edit=1