Skip to content

Commit 0427e26

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix #80092: ZTS + preload = segfault on shutdown
2 parents ba1d9d0 + 28a909d commit 0427e26

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.3.0RC4
44

5+
- Core:
6+
. Fixed bug #80092 (ZTS + preload = segfault on shutdown). (nielsdos)
7+
58
- CType:
69
. Fixed bug GH-11997 (ctype_alnum 5 times slower in PHP 8.1 or greater).
710
(nielsdos)

ext/opcache/ZendAccelerator.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4629,6 +4629,8 @@ static zend_result accel_finish_startup_preload(bool in_child)
46294629
SIGG(check) = false;
46304630
#endif
46314631
php_request_shutdown(NULL); /* calls zend_shared_alloc_unlock(); */
4632+
EG(class_table) = NULL;
4633+
EG(function_table) = NULL;
46324634
PG(report_memleaks) = orig_report_memleaks;
46334635
} else {
46344636
zend_shared_alloc_unlock();

sapi/cli/tests/bug80092.phpt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
Bug #80092 (ZTS + preload = segfault on shutdown)
3+
--SKIPIF--
4+
<?php
5+
include 'skipif.inc';
6+
if (substr(PHP_OS, 0, 3) == 'WIN') {
7+
die ("skip not for Windows");
8+
}
9+
$extDir = ini_get('extension_dir');
10+
if (!file_exists($extDir . '/opcache.so')) {
11+
die ('skip opcache shared object not found in extension_dir');
12+
}
13+
?>
14+
--FILE--
15+
<?php
16+
17+
$cmd = [
18+
PHP_BINARY, '-n',
19+
'-dextension_dir=' . ini_get('extension_dir'),
20+
'-dzend_extension=opcache.so',
21+
'-dopcache.enable=1',
22+
'-dopcache.enable_cli=1',
23+
'-dopcache.preload=' . __DIR__ . '/preload.inc',
24+
'-v'
25+
];
26+
27+
$proc = proc_open($cmd, [['null'], ['pipe', 'w'], ['redirect', 1]], $pipes);
28+
echo stream_get_contents($pipes[1]);
29+
30+
?>
31+
--EXPECTF--
32+
preloaded
33+
PHP %s
34+
Copyright (c) The PHP Group
35+
Zend Engine %s
36+
with Zend OPcache %s

sapi/cli/tests/preload.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
class SomeClass {}
4+
5+
function foo() {}
6+
7+
echo "preloaded\n";

0 commit comments

Comments
 (0)