mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3'
* PHP-8.3: Fix #80092: ZTS + preload = segfault on shutdown
This commit is contained in:
commit
e2c50f6bcb
3 changed files with 45 additions and 0 deletions
|
@ -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();
|
||||||
|
|
36
sapi/cli/tests/bug80092.phpt
Normal file
36
sapi/cli/tests/bug80092.phpt
Normal 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
|
7
sapi/cli/tests/preload.inc
Normal file
7
sapi/cli/tests/preload.inc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class SomeClass {}
|
||||||
|
|
||||||
|
function foo() {}
|
||||||
|
|
||||||
|
echo "preloaded\n";
|
Loading…
Add table
Add a link
Reference in a new issue