1--TEST--
2SQLite3::setAuthorizer use F ZPP for trampoline callback and does not leak
3--EXTENSIONS--
4sqlite3
5--FILE--
6<?php
7
8class TrampolineTest {
9    public function __call(string $name, array $arguments) {
10        echo 'Trampoline for ', $name, PHP_EOL;
11        if ($arguments[0] == SQLite3::SELECT) {
12            return SQLite3::OK;
13        }
14
15        return SQLite3::DENY;
16    }
17}
18$o = new TrampolineTest();
19$callback = [$o, 'authorizer'];
20
21$db = new SQLite3(':memory:');
22$db->enableExceptions(true);
23
24echo "Invalid SQLite3 object:\n";
25$rc = new ReflectionClass(SQLite3::class);
26$obj = $rc->newInstanceWithoutConstructor();
27
28try {
29    var_dump($obj->setAuthorizer($callback));
30} catch (\Throwable $e) {
31    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
32}
33
34$db->setAuthorizer($callback);
35
36?>
37DONE
38--EXPECT--
39Invalid SQLite3 object:
40Error: The SQLite3 object has not been correctly initialised or is already closed
41DONE
42