xref: /PHP-8.4/ext/pdo_sqlite/tests/gh9032.phpt (revision 8ed21a89)
1--TEST--
2SQLite3 authorizer crashes on NULL values
3--EXTENSIONS--
4pdo_sqlite
5--INI--
6open_basedir=.
7--FILE--
8<?php
9$db = new PDO("sqlite::memory:", null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
10
11$db->exec('attach database \':memory:\' AS "db1"');
12var_dump($db->exec('create table db1.r (id int)'));
13
14try {
15$st = $db->prepare('attach database :a AS "db2"');
16$st->execute([':a' => ':memory:']);
17var_dump($db->exec('create table db2.r (id int)'));
18} catch (PDOException $ex) {
19    echo $ex->getMessage(), PHP_EOL;
20}
21?>
22--EXPECT--
23int(0)
24SQLSTATE[HY000]: General error: 23 not authorized
25