[php-src] Issue #9749: Segmentation fault on PDO::sqliteCreateFunction with SQLite driver on PHP 8.2.0RC4

From: Date: Fri, 14 Oct 2022 13:28:29 +0000
Subject: [php-src] Issue #9749: Segmentation fault on PDO::sqliteCreateFunction with SQLite driver on PHP 8.2.0RC4
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242595@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9749 Author: llaville ### Description The following code: ```php <?php class SqlitePlatform { public static function udfSqrt($value) { return sqrt($value); } } $userDefinedFunctions = [ 'sqrt' => ['callback' => [SqlitePlatform::class, 'udfSqrt'], 'numArgs' => 1], ]; $dsn = "sqlite:user-db.sqlite"; try { $pdo = new PDO($dsn); foreach ($userDefinedFunctions as $fn => $data) { $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']); } \var_dump($pdo); } catch (PDOException $e) { \var_dump($e); } ``` Code used is pick from https://github.com/doctrine/dbal/blob/3.4.x/src/Driver/PDO/SQLite/Driver.php, doctrine/dbal 3.4.5 I used from my project Resulted in this output: ``` Segmentation fault ``` But I expected this output instead: ``` object(PDO)#1 (0) { } ``` When I comment the foreach loop, PDO object is created ! It seems there is a regression since PHP 8.2.0-dev (182c8acf432c25150067f6224faacaafd5d9b8b4) My use case that works fine : https://github.com/llaville/php-compatinfo-db/actions/runs/3219733272/jobs/5265516763#step:6:14 ### PHP Version PHP 8.2.0RC4 ### Operating System Ubuntu 18.04

« previous php.bugs (#242595) next »