[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | David Carlier | Date: | Wed, 25 Nov 2026 21:57:40 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-144179@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-11-25T21:56:13Z
Commit: https://github.com/php/php-src/commit/e691e4d622f343b01a619ff7447c12b74d391a69
Raw diff: https://github.com/php/php-src/commit/e691e4d622f343b01a619ff7447c12b74d391a69.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
ext/pgsql: fix pg_fetch_all_columns() JIT crash on a modified empty result
Changed paths:
A ext/pgsql/tests/gh25760.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 d09d06318685..193e9e9b4c06 100644
--- a/Zend/Optimizer/zend_func_infos.h
+++ b/Zend/Optimizer/zend_func_infos.h
@@ -319,7 +319,7 @@ static const func_info_t func_infos[] = {
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),
- F1("pg_fetch_all_columns",
MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL),
+ 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),
F1("pg_lo_create", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE),
F1("pg_lo_open", MAY_BE_OBJECT|MAY_BE_FALSE),
diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php
index c04ed10c693f..8a2847cd87ea 100644
--- a/ext/pgsql/pgsql.stub.php
+++ b/ext/pgsql/pgsql.stub.php
@@ -636,7 +636,6 @@ function pg_fetch_all(PgSql\Result $result, int $mode = PGSQL_ASSOC): array {}
/**
* @return array<int, string|null>
- * @refcount 1
*/
function pg_fetch_all_columns(PgSql\Result $result, int $field = 0): array {}
diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h
index d63b98bfe1b9..47d0855c9069 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: 479126d506a84c7196796f4980d1e9e471ca71ae */
+ * Stub hash: 5e2eb05437a08252a9554c45711febbf4a846bcc */
#include "zend_attributes.h"
#include "zend_constants.h"
diff --git a/ext/pgsql/tests/gh25760.phpt b/ext/pgsql/tests/gh25760.phpt
new file mode 100644
index 000000000000..69148e9a0432
--- /dev/null
+++ b/ext/pgsql/tests/gh25760.phpt
@@ -0,0 +1,31 @@
+--TEST--
+GH-25760: pg_fetch_all_columns() crashes with JIT when the result for an empty set is modified
+--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");
+
+function test(PgSql\Result $result) {
+ $columns = pg_fetch_all_columns($result);
+ $columns[] = 1;
+ return $columns;
+}
+
+$conn = pg_connect($conn_str);
+var_dump(test(pg_query($conn, "SELECT 1 WHERE false")));
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ int(1)
+}