[php-src] master: Merge branch 'PHP-8.6'

From: Date: Thu, 26 Nov 2026 12:29:08 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144217@lists.php.net to get a copy of this message
Author: David Carlier (devnexen) Date: 2026-11-26T12:24:58Z Commit: https://github.com/php/php-src/commit/6741f32f4fe552baf96db5cff9960de25e0cbd52 Raw diff: https://github.com/php/php-src/commit/6741f32f4fe552baf96db5cff9960de25e0cbd52.diff Merge branch 'PHP-8.6' * PHP-8.6: ext/pgsql: fix pg_fetch_object() JIT crash when constructor keeps $this Changed paths: A ext/pgsql/tests/gh25772.phpt M Zend/Optimizer/zend_func_infos.h M ext/pgsql/pgsql.stub.php M ext/pgsql/pgsql_arginfo.h Diff: diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index c2a95c844a67..b2aa7b77950f 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -317,7 +317,6 @@ static const func_info_t func_infos[] = { F1("pg_fetch_row", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL|MAY_BE_FALSE), F1("pg_fetch_assoc", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL|MAY_BE_FALSE), F1("pg_fetch_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL|MAY_BE_FALSE), - F1("pg_fetch_object", MAY_BE_OBJECT|MAY_BE_FALSE), F1("pg_fetch_all", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY), FN("pg_fetch_all_columns", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL), F1("pg_last_oid", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE), diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php index 8a2847cd87ea..b10455037717 100644 --- a/ext/pgsql/pgsql.stub.php +++ b/ext/pgsql/pgsql.stub.php @@ -625,7 +625,6 @@ function pg_fetch_assoc(PgSql\Result $result, ?int $row = null): array|false {} */ function pg_fetch_array(PgSql\Result $result, ?int $row = null, int $mode = PGSQL_BOTH): array|false {} - /** @refcount 1 */ function pg_fetch_object(PgSql\Result $result, ?int $row = null, string $class = "stdClass", array $constructor_args = []): object|false {} /** diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h index 47d0855c9069..ae6d3db5ebb5 100644 --- a/ext/pgsql/pgsql_arginfo.h +++ b/ext/pgsql/pgsql_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit pgsql.stub.php instead. - * Stub hash: 5e2eb05437a08252a9554c45711febbf4a846bcc */ + * Stub hash: a9b191d12693f913c9573da7354398bf36e9e019 */ #include "zend_attributes.h" #include "zend_constants.h" diff --git a/ext/pgsql/tests/gh25772.phpt b/ext/pgsql/tests/gh25772.phpt new file mode 100644 index 000000000000..0d3008c2b470 --- /dev/null +++ b/ext/pgsql/tests/gh25772.phpt @@ -0,0 +1,41 @@ +--TEST-- +GH-25772: pg_fetch_object() crashes with JIT when the constructor keeps a reference and the result is discarded +--EXTENSIONS-- +pgsql +opcache +--SKIPIF-- +<?php include("inc/skipif.inc"); ?> +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.jit_buffer_size=64M +opcache.file_update_protection=0 +--FILE-- +<?php +include("inc/config.inc"); + +class Row { + public static array $rows = []; + + public function __construct() { + self::$rows[] = $this; + } +} + +function test(PgSql\Result $result) { + pg_fetch_object($result, 0, Row::class); +} + +$conn = pg_connect($conn_str); +test(pg_query($conn, "SELECT 1 AS id")); +var_dump(Row::$rows); +?> +--EXPECTF-- +array(1) { + [0]=> + object(Row)#%d (1) { + ["id"]=> + string(1) "1" + } +}

« previous php.cvs (#144217) next »