Commit 4ca576ac50a for php

commit 4ca576ac50a3313a5390c4456fe15caffa12c933
Author: Tomasz Kowalczyk <tomasz@kowalczyk.cc>
Date:   Fri Nov 27 08:26:39 2026 +0100

    ext/pgsql: pg_meta_data() numeric column names not integer keys with opcache

    pg_meta_data() adds the column names with add_assoc_zval(), so numeric
    column names become integer keys, but the stub's @return tag allowed only
    string keys. The generated optimizer info therefore lacked
    MAY_BE_ARRAY_KEY_LONG, and opcache folded is_int() checks on the keys to
    false; function JIT crashed. This changes the tag to
    array<int|string, array>|false and regenerates the arginfo and optimizer
    info. The test fails without the change.

    Fix GH-25825
    Close GH-25826

diff --git a/NEWS b/NEWS
index 01ce41b8ba4..bd6d660d93b 100644
--- a/NEWS
+++ b/NEWS
@@ -187,6 +187,8 @@ PHP                                                                        NEWS
     keeps a reference and the result is discarded). (Tomasz Kowalczyk)
   . Fixed bug GH-25802 (pg_get_notify() result is never === false with opcache
     enabled). (Tomasz Kowalczyk)
+  . Fixed bug GH-25825 (pg_meta_data() numeric column names are not integer keys
+    with opcache enabled). (Tomasz Kowalczyk)

 - Phar:
   . Fixed bug GH-25528 (Phar::setSignatureAlgorithm(): OpenSSL signing reads a
diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h
index 632e7bf98ba..ba1f5bf2f8e 100644
--- a/Zend/Optimizer/zend_func_infos.h
+++ b/Zend/Optimizer/zend_func_infos.h
@@ -335,7 +335,7 @@ static const func_info_t func_infos[] = {
 	F1("pg_result_status", MAY_BE_STRING|MAY_BE_LONG),
 	F1("pg_get_notify", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
 	F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE),
-	F1("pg_meta_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
+	F1("pg_meta_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
 	F1("pg_convert", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
 	F1("pg_insert", MAY_BE_OBJECT|MAY_BE_STRING|MAY_BE_BOOL),
 	F1("pg_update", MAY_BE_STRING|MAY_BE_BOOL),
diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php
index e9c5c392229..83c17f631be 100644
--- a/ext/pgsql/pgsql.stub.php
+++ b/ext/pgsql/pgsql.stub.php
@@ -924,7 +924,7 @@ function pg_consume_input(PgSql\Connection $connection): bool {}
     function pg_flush(PgSql\Connection $connection): int|bool {}

     /**
-     * @return array<string, array>|false
+     * @return array<int|string, array>|false
      * @refcount 1
      */
     function pg_meta_data(PgSql\Connection $connection, string $table_name, bool $extended = false): array|false {}
diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h
index 5ee977a14f0..8d6f74f427d 100644
Binary files a/ext/pgsql/pgsql_arginfo.h and b/ext/pgsql/pgsql_arginfo.h differ
diff --git a/ext/pgsql/tests/gh25825.phpt b/ext/pgsql/tests/gh25825.phpt
new file mode 100644
index 00000000000..feb751b80fe
--- /dev/null
+++ b/ext/pgsql/tests/gh25825.phpt
@@ -0,0 +1,35 @@
+--TEST--
+GH-25825: pg_meta_data() numeric column names are not integer keys with opcache enabled
+--EXTENSIONS--
+pgsql
+opcache
+--SKIPIF--
+<?php include("inc/skipif.inc"); ?>
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+--FILE--
+<?php
+include('inc/config.inc');
+$table = 'pg_meta_data_numeric_column';
+
+function check(PgSql\Connection $db, string $table): void {
+    foreach (pg_meta_data($db, $table) as $name => $meta) {
+        var_dump($name, is_int($name));
+    }
+}
+
+$db = pg_connect($conn_str);
+pg_query($db, "CREATE TABLE {$table} (\"123\" integer)");
+check($db, $table);
+?>
+--CLEAN--
+<?php
+include('inc/config.inc');
+$db = pg_connect($conn_str);
+pg_query($db, 'DROP TABLE IF EXISTS pg_meta_data_numeric_column');
+?>
+--EXPECT--
+int(123)
+bool(true)