Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix #80092: ZTS + preload = segfault on shutdown
This commit is contained in:
Niels Dossche 2023-10-02 19:42:45 +02:00
commit e2c50f6bcb
3 changed files with 45 additions and 0 deletions

View file

@ -4629,6 +4629,8 @@ static zend_result accel_finish_startup_preload(bool in_child)
SIGG(check) = false; SIGG(check) = false;
#endif #endif
php_request_shutdown(NULL); /* calls zend_shared_alloc_unlock(); */ php_request_shutdown(NULL); /* calls zend_shared_alloc_unlock(); */
EG(class_table) = NULL;
EG(function_table) = NULL;
PG(report_memleaks) = orig_report_memleaks; PG(report_memleaks) = orig_report_memleaks;
} else { } else {
zend_shared_alloc_unlock(); zend_shared_alloc_unlock();

View file

@ -0,0 +1,36 @@
--TEST--
Bug #80092 (ZTS + preload = segfault on shutdown)
--SKIPIF--
<?php
include 'skipif.inc';
if (substr(PHP_OS, 0, 3) == 'WIN') {
die ("skip not for Windows");
}
$extDir = ini_get('extension_dir');
if (!file_exists($extDir . '/opcache.so')) {
die ('skip opcache shared object not found in extension_dir');
}
?>
--FILE--
<?php
$cmd = [
PHP_BINARY, '-n',
'-dextension_dir=' . ini_get('extension_dir'),
'-dzend_extension=opcache.so',
'-dopcache.enable=1',
'-dopcache.enable_cli=1',
'-dopcache.preload=' . __DIR__ . '/preload.inc',
'-v'
];
$proc = proc_open($cmd, [['null'], ['pipe', 'w'], ['redirect', 1]], $pipes);
echo stream_get_contents($pipes[1]);
?>
--EXPECTF--
preloaded
PHP %s
Copyright (c) The PHP Group
Zend Engine %s
with Zend OPcache %s

View file

@ -0,0 +1,7 @@
<?php
class SomeClass {}
function foo() {}
echo "preloaded\n";