diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index a2d964c15070..70f3d8313638 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(); } diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index ffa09aaf9e67..2fb7e775bb34 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -93,6 +93,11 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) static ZEND_INI_MH(OnUpdateInternedStringsBuffer) { + if (accel_startup_ok) { + zend_accel_error(ACCEL_LOG_WARNING, "opcache.interned_strings_buffer cannot be changed when OPcache is already set up."); + 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-- +