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