Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
5 changes: 5 additions & 0 deletions ext/opcache/zend_accelerator_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--TEST--
FPM: GH-23288 - opcache.interned_strings_buffer overridden per pool must not crash on restart
--EXTENSIONS--
opcache
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
<?php

require_once "tester.inc";

$cfg = <<<EOT
[global]
error_log = {{FILE:LOG}}
[unconfined]
listen = {{ADDR}}
pm = static
pm.max_children = 1
php_admin_value[opcache.interned_strings_buffer] = 8
EOT;

$code = <<<EOT
<?php
opcache_reset();
opcache_reset();
echo "ok";
EOT;

$opcache = ini_get('extension_dir') . DIRECTORY_SEPARATOR . 'opcache.' . PHP_SHLIB_SUFFIX;
$extraArgs = is_file($opcache) ? ['-dzend_extension=' . $opcache] : [];

$tester = new FPM\Tester($cfg, $code);
$tester->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--
<?php
require_once "tester.inc";
FPM\Tester::clean();
?>
Loading