/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_wrong_callback.phpt
24 строки
649 B
David CARLIER
ext/pdo_sqlite: Fix GH-18796 test exception message. (#18798)
07 июн 2025, 17:53
Не верифицирован
07 июн 2025, 17:53
ceffa70
Код
Авторство
О чём код?
--TEST-- Pdo\Sqlite::createCollation() memory leaks on wrong callback return type --EXTENSIONS-- pdo_sqlite --FILE-- <?php declare(strict_types=1); $db = new Pdo\Sqlite('sqlite::memory:'); $db->exec("CREATE TABLE test (c string)"); $db->exec("INSERT INTO test VALUES('youwontseeme')"); $db->exec("INSERT INTO test VALUES('neither')"); $db->createCollation('NAT', function($a, $b): string { return $a . $b; }); try { $db->query("SELECT c FROM test ORDER BY c COLLATE NAT"); } catch (\TypeError $e) { echo $e->getMessage(), PHP_EOL; } ?> --EXPECT-- PDO::query(): Return value of the collation callback must be of type int, string returned