xref: /PHP-8.4/ext/sqlite3/tests/gh9032.phpt (revision ddd9a08f)
1--TEST--
2SQLite3 authorizer crashes on NULL values
3--EXTENSIONS--
4sqlite3
5--INI--
6open_basedir=.
7--FILE--
8<?php
9$db = new SQLite3(":memory:");
10$db->enableExceptions(true);
11
12$db->exec('attach database \':memory:\' AS "db1"');
13var_dump($db->exec('create table db1.r (id int)'));
14
15try {
16    $st = $db->prepare('attach database :a AS "db2"');
17    $st->bindValue("a", ":memory:");
18    $st->execute();
19    var_dump($db->exec('create table db2.r (id int)'));
20} catch (SQLite3Exception $ex) {
21    echo $ex->getMessage(), PHP_EOL;
22}
23?>
24--EXPECT--
25bool(true)
26Unable to prepare statement: not authorized
27