Download src/php/php-src/ext/pdo_firebird/tests/bug_15604.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pdo_firebird/tests/bug_15604.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/pdo_firebird/tests/bug_15604.phpt
-
curl -L -o bug_15604.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/pdo_firebird/tests/bug_15604.phpt
1.4 kB
| --TEST-- | |
| Bug #15604 It is not possible to pass a NULL value as an input parameter if the field is marked as NOT NULL. | |
| --EXTENSIONS-- | |
| pdo_firebird | |
| --SKIPIF-- | |
| require('skipif.inc'); | |
| --FILE-- | |
| require_once 'testdb.inc'; | |
| $dbh = getDbConnection(); | |
| $dbh->exec(' | |
| recreate table t_bug_15604 ( | |
| id int not null, | |
| a int not null, | |
| b int, | |
| constraint pk_bug_15604 primary key(id) | |
| ) | |
| '); | |
| $dbh->exec('recreate sequence g_bug_15604'); | |
| $dbh->exec(<<<'SQL' | |
| create or alter trigger t_bug_15604_bi0 for t_bug_15604 | |
| active before insert position 0 | |
| as | |
| begin | |
| if (new.id is null) then | |
| new.id = next value for g_bug_15604; | |
| end | |
| SQL | |
| ); | |
| $stmt = $dbh->prepare('insert into t_bug_15604(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_15604 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); | |
| echo "\nOK\n"; | |
| --CLEAN-- | |
| require_once 'testdb.inc'; | |
| $dbh = getDbConnection(); | |
| @$dbh->exec('drop table t_bug_15604'); | |
| @$dbh->exec('drop sequence g_bug_15604'); | |
| unset($dbh); | |
| --EXPECTF-- | |
| bool(false) | |
| array(3) { | |
| ["ID"]=> | |
| %r(int\(2\)|string\(1\) "2")%r | |
| ["A"]=> | |
| int(2) | |
| ["B"]=> | |
| NULL | |
| } | |
| OK | |