You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pdo_firebird: It is not possible to pass a NULL value as an input parameter if the field is marked as NOT NULL. #15604
<?php$dbh = newPDO('firebird:dbname=inet://localhost/employee', 'SYSDBA', 'masterkey');
$dbh->exec('recreate table t_bug_0001 ( id bigint not null, a int not null, b int, constraint pk_bug_0001 primary key(id))');
$dbh->exec('recreate sequence g_bug_0001');
$dbh->exec(<<<'SQL'
create or alter trigger t_bug_0001_bi0 for t_bug_0001active before insert position 0asbegin if (new.id is null) then new.id = next value for g_bug_0001;end
SQL
);
$stmt = $dbh->prepare('insert into t_bug_0001(id, a, b) values(?, ?, ?)');
$stmt->execute([null, 1, 2]);
$stmt->execute([2, 2, null]);
unset($stmt);
$stmt2 = $dbh->prepare('SELECT id, a, b FROM t_bug_0001 WHERE id = ?');
$stmt2->execute([null]);
$data = $stmt2->fetch(\PDO::FETCH_ASSOC);
$stmt2->closeCursor();
var_dump($data);
$stmt2->execute([2]);
$data = $stmt2->fetch(\PDO::FETCH_ASSOC);
$stmt2->closeCursor();
var_dump($data);
unset($stmt2);
$dbh->exec('drop table t_bug_0001');
$dbh->exec('drop sequence g_bug_0001');
echo"\nOK\n";
Resulted in this output:
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY105]: Invalid parameter type: -999 Parameter requires non-null value in D:\IBase\php-test\null_params.php:28
Stack trace:
#0 D:\IBase\php-test\null_params.php(28): PDOStatement->execute()
#1 {main}
thrown in D:\IBase\php-test\null_params.php on line 28
Activity
ext/pdo_firebird: Fixed phpGH-15604 Always make input parameters null…