com php-src: Fixed bug #78175 (Preloading segfaults at preload time and at runtime): NEWS ext/opcache/ZendAccelerator.c
ext/opcache/tests/bug78175.phpt ext/opcache/tests/preload_bug 78175.inc
| From: | Dmitry Stogov | Date: | Tue, 18 Jun 2019 14:18:49 +0000 |
| Subject: | com php-src: Fixed bug #78175 (Preloading segfaults at preload time and at runtime): NEWS ext/opcache/ZendAccelerator.c ext/opcache/tests/bug78175.phpt ext/opcache/tests/preload_bug 78175.inc |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106868@lists.php.net to get a copy of this message | ||
Commit: 148eb202268b0c2786e9f541b46138e5d1271761
Author: Dmitry Stogov <dmitry@zend.com> Tue, 18 Jun 2019 17:18:49 +0300
Parents: 04a6aac59beaac2ef2e91b9e3c07299f7321eae7
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=148eb202268b0c2786e9f541b46138e5d1271761
Log:
Fixed bug #78175 (Preloading segfaults at preload time and at runtime)
Bugs:
https://bugs.php.net/78175
Changed paths:
M NEWS
M ext/opcache/ZendAccelerator.c
A ext/opcache/tests/bug78175.phpt
A ext/opcache/tests/preload_bug78175.inc
Diff:
diff --git a/NEWS b/NEWS
index 4e8b6f23..79486fa 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ PHP NEWS
- Opcache:
. Fixed bug #78106 (Path resolution fails if opcache disabled during request).
(Nikita)
+ . Fixed bug #78175 (Preloading segfaults at preload time and at runtime).
+ (Dmitry)
- SQLite3:
. Implement FR ##70950 (Make SQLite3 Online Backup API available). (BohwaZ)
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index e75ae03..85e0de9 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -4081,10 +4081,25 @@ static int accel_preload(const char *config)
ping_auto_globals_mask = zend_accel_get_auto_globals_no_jit();
}
+ /* Cleanup executor */
+ EG(flags) |= EG_FLAGS_IN_SHUTDOWN;
+
+ php_call_shutdown_functions();
+ zend_call_destructors();
+ php_free_shutdown_functions();
+
/* Release stored values to avoid dangling pointers */
zend_hash_graceful_reverse_destroy(&EG(symbol_table));
zend_hash_init(&EG(symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
+#if ZEND_DEBUG
+ if (gc_enabled() && !CG(unclean_shutdown)) {
+ gc_collect_cycles();
+ }
+#endif
+
+ zend_objects_store_free_object_storage(&EG(objects_store), 1);
+
/* Inheritance errors may be thrown during linking */
zend_try {
preload_link();
diff --git a/ext/opcache/tests/bug78175.phpt b/ext/opcache/tests/bug78175.phpt
new file mode 100644
index 0000000..eb513e3
--- /dev/null
+++ b/ext/opcache/tests/bug78175.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #78175 (Preloading segfaults at preload time and at runtime)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.preload={PWD}/preload_bug78175.inc
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+OK
+--EXPECT--
+Shutdown
+OK
diff --git a/ext/opcache/tests/preload_bug78175.inc b/ext/opcache/tests/preload_bug78175.inc
new file mode 100644
index 0000000..bf3f338
--- /dev/null
+++ b/ext/opcache/tests/preload_bug78175.inc
@@ -0,0 +1,4 @@
+<?php
+register_shutdown_function(function() {
+ echo "Shutdown\n";
+});