You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pg_lo_open segfaults in the strict_types mode #10672
<?phpdeclare(strict_types=1);
$conn = pg_connect("host='127.0.0.1' dbname='postgres' user='postgres' password='Passw0rd'");
if ($conn === false) {
die(pg_last_error());
}
// Begin a transactionpg_query($conn, 'BEGIN');
// Create an empty large object$oid = pg_lo_create($conn);
if ($oid === false) {
die(pg_last_error($conn));
}
// Open the large object for writing$lob = pg_lo_open($conn, $oid, 'w');
if ($oid === false) {
die(pg_last_error($conn));
}
echo'The large object has been opened successfully.', PHP_EOL;
Resulted in this output:
Fatal error: Uncaught ValueError: Mode must be one of 'r', 'r+', 'w', or 'w+' in /Users/morozov/pgsql-bug.php:22
Stack trace:
#0 /Users/morozov/pgsql-bug.php(22): pg_lo_open(Object(PgSql\Connection), 16896, 'w')
#1 {main}
thrown in /Users/morozov/pgsql-bug.php on line 22
fish: Job 1, 'php pgsql-bug.php' terminated by signal SIGSEGV (Address boundary error)
But I expected this output instead:
The large object has been opened successfully.
Commenting out the declare(strict_types=1); line addresses the issue.
Activity
Girgias commentedon Feb 23, 2023
The issue is that we use the wrong ZPP format on line 2340
as
sexpects achar*andsize_tpair, whereas we are passing in azend_string.Surprised this is only getting caught now...
Fix github bug php#10672
Fix phpGH-10672 (pg_lo_open segfaults in the strict_types mode)
Fix GH-10672 (pg_lo_open segfaults in the strict_types mode)
Merge branch 'PHP-8.1' into PHP-8.2
Merge branch 'PHP-8.2'