Closed as not planned
Closed as not planned
Description
Description
The following code:
<?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 (182c8ac)
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