From:             
Operating system: Windows 7
PHP version:      5.4.3
Package:          PDO related
Bug Type:         Bug
Bug description:Cannot insert second row with null using parametrized query 
(Firebird PDO)

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 bug report at https://bugs.php.net/bug.php?id=62024&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62024&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62024&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62024&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62024&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62024&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62024&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62024&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62024&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62024&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62024&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62024&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62024&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62024&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62024&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62024&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62024&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62024&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62024&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62024&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62024&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62024&r=mysqlcfg

Reply via email to