From fb604aab1d581b5d51057208ab921eb94cc5f466 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Tue, 18 Aug 2026 10:04:56 +0200 Subject: [PATCH 1/2] ext/pgsql: fix the class name casing of pg_close_stmt()'s connection The stub spelled it Pgsql\Connection, the only such spelling in the extension. Resolution is case-insensitive, but Reflection reported a class name that does not match the declared one. Close GH-23393 --- NEWS | 4 ++++ ext/pgsql/pgsql.stub.php | 2 +- ext/pgsql/pgsql_arginfo.h | 4 ++-- .../tests/pg_close_stmt_parameter_type.phpt | 22 +++++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 ext/pgsql/tests/pg_close_stmt_parameter_type.phpt diff --git a/NEWS b/NEWS index 78265622e7d7..887ff5b3401d 100644 --- a/NEWS +++ b/NEWS @@ -58,6 +58,10 @@ PHP NEWS left busy for the next fetch, and rows delivered from a result another statement took over. (KentarouTakeda) +- PGSQL: + . Fixed the class name casing of pg_close_stmt()'s connection parameter. + (lacatoire) + - Phar: . Fixed Phar archives being automatically detected when ".phar" only occurs in a directory name or is not a filename extension in an included file's diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php index 52ddc3b3748a..8c5a7f4c6d98 100644 --- a/ext/pgsql/pgsql.stub.php +++ b/ext/pgsql/pgsql.stub.php @@ -956,7 +956,7 @@ function pg_socket_poll($socket, int $read, int $write, int $timeout = -1): int function pg_set_chunked_rows_size(PgSql\Connection $connection, int $size): bool {} #endif #ifdef HAVE_PG_CLOSE_STMT - function pg_close_stmt(Pgsql\Connection $connection, string $statement_name): PgSql\Result|false {} + function pg_close_stmt(PgSql\Connection $connection, string $statement_name): PgSql\Result|false {} #endif } diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h index 63a1d185d535..974a6e9117cd 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: f25b5a574c96d4bc2f08b8cacab16f499a164a6b */ + * Stub hash: fa7cd778f4e791b15ffc8f1786384332449bda5a */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0) @@ -503,7 +503,7 @@ ZEND_END_ARG_INFO() #if defined(HAVE_PG_CLOSE_STMT) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_close_stmt, 0, 2, PgSql\\Result, MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, connection, Pgsql\\Connection, 0) + ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0) ZEND_ARG_TYPE_INFO(0, statement_name, IS_STRING, 0) ZEND_END_ARG_INFO() #endif diff --git a/ext/pgsql/tests/pg_close_stmt_parameter_type.phpt b/ext/pgsql/tests/pg_close_stmt_parameter_type.phpt new file mode 100644 index 000000000000..c9c6c4f40ad5 --- /dev/null +++ b/ext/pgsql/tests/pg_close_stmt_parameter_type.phpt @@ -0,0 +1,22 @@ +--TEST-- +pg_close_stmt(): the connection parameter is typed like every other pgsql function +--EXTENSIONS-- +pgsql +--SKIPIF-- += 17'); +?> +--FILE-- +getParameters()[0]; + printf("%-16s %s\n", $function, $parameter->getType()); +} + +var_dump((new ReflectionClass(PgSql\Connection::class))->getName()); +?> +--EXPECT-- +pg_close_stmt PgSql\Connection +pg_connect_poll PgSql\Connection +string(16) "PgSql\Connection" From bfbae397a3a0240ab3d690d71f240af66300cbc6 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 20 Aug 2026 22:22:56 +0100 Subject: [PATCH 2/2] ext/opcache: opcache.interned_strings_buffer per FPM pool crashed on restart. Fix #23288 The directive was still accepted once the shared interned string table had been sized from the master php.ini, so a diverging pool value made the next restart run accel_interned_strings_restore_state() against a table that was never allocated. Reject post-startup changes like opcache.memory_consumption and gate the restore on the shared table state instead of the per-process directive. Close GH-23309 --- NEWS | 2 + ext/opcache/ZendAccelerator.c | 4 +- ext/opcache/zend_accelerator_module.c | 9 ++++ ...-opcache-interned-strings-buffer-pool.phpt | 50 +++++++++++++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 sapi/fpm/tests/gh23288-opcache-interned-strings-buffer-pool.phpt diff --git a/NEWS b/NEWS index a672360f0aef..86b6bd3e2e0c 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,8 @@ PHP NEWS - Opcache: . Fixed opcache.protect_memory race under ZTS. (realFlowControl) + . Fixed bug GH-23288 (Crash on restart when opcache.interned_strings_buffer + is overridden in an individual FPM pool). (David Carlier) - PDO: . Fixed a leak when a persistent connection failed a liveness check diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index a2d964c15070..221cc55d9f6d 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2715,7 +2715,7 @@ ZEND_RINIT_FUNCTION(zend_accelerator) zend_reset_cache_vars(); zend_accel_hash_clean(&ZCSG(hash)); - if (ZCG(accel_directives).interned_strings_buffer) { + if (ZCSG(interned_strings).saved_top) { accel_interned_strings_restore_state(); } @@ -3444,6 +3444,8 @@ void accel_shutdown(void) if ((ini_entry = zend_hash_str_find_ptr(EG(ini_directives), "include_path", sizeof("include_path")-1)) != NULL) { ini_entry->on_modify = orig_include_path_on_modify; } + + accel_startup_ok = false; } void zend_accel_schedule_restart(zend_accel_restart_reason reason) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index ffa09aaf9e67..23192e8950bf 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -93,6 +93,15 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) static ZEND_INI_MH(OnUpdateInternedStringsBuffer) { + if (accel_startup_ok) { + if (strcmp(sapi_module.name, "fpm-fcgi") == 0) { + zend_accel_error(ACCEL_LOG_WARNING, "opcache.interned_strings_buffer cannot be changed when OPcache is already set up. Are you using php_admin_value[opcache.interned_strings_buffer] in an individual pool's configuration?\n"); + } else { + zend_accel_error(ACCEL_LOG_WARNING, "opcache.interned_strings_buffer cannot be changed when OPcache is already set up.\n"); + } + return FAILURE; + } + zend_long *p = (zend_long *) ZEND_INI_GET_ADDR(); zend_long size = zend_ini_parse_quantity_warn(new_value, entry->name); diff --git a/sapi/fpm/tests/gh23288-opcache-interned-strings-buffer-pool.phpt b/sapi/fpm/tests/gh23288-opcache-interned-strings-buffer-pool.phpt new file mode 100644 index 000000000000..8f48b3a8c209 --- /dev/null +++ b/sapi/fpm/tests/gh23288-opcache-interned-strings-buffer-pool.phpt @@ -0,0 +1,50 @@ +--TEST-- +FPM: GH-23288 - opcache.interned_strings_buffer overridden per pool must not crash on restart +--EXTENSIONS-- +opcache +--SKIPIF-- + +--FILE-- +start($extraArgs, iniEntries: ['opcache.interned_strings_buffer' => '0']); +$tester->expectLogStartNotices(); +$tester->request()->expectBody('ok'); +$tester->request()->expectBody('ok'); +$tester->request()->expectBody('ok'); +$tester->terminate(); +$tester->expectLogTerminatingNotices(); +$tester->close(); + +?> +Done +--EXPECT-- +Done +--CLEAN-- +