com php-src: Remember __COMPILER_HALT_OFFSET__(s ) in preloaded scripts: ext/opcache/ZendAccelerator .c
| From: | Dmitry Stogov | Date: | Wed, 20 Feb 2019 14:10:10 +0000 |
| Subject: | com php-src: Remember __COMPILER_HALT_OFFSET__(s ) in preloaded scripts: ext/opcache/ZendAccelerator .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104781@lists.php.net to get a copy of this message | ||
Commit: 4f2ad75dbef9e338611a1a37ecc378276df07544
Author: Dmitry Stogov <dmitry@zend.com> Wed, 20 Feb 2019 17:10:10 +0300
Parents: e53e753c0e90df0039b4789850b2870cf92a8450
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4f2ad75dbef9e338611a1a37ecc378276df07544
Log:
Remember __COMPILER_HALT_OFFSET__(s) in preloaded scripts
Changed paths:
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 549c263..60be360 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -3933,6 +3933,22 @@ static int accel_preload(const char *config)
if (EG(zend_constants)) {
zend_string *key;
zval *zv;
+
+ /* Remember __COMPILER_HALT_OFFSET__(s) */
+ ZEND_HASH_FOREACH_PTR(preload_scripts, script) {
+ zend_execute_data *orig_execute_data = EG(current_execute_data);
+ zend_execute_data fake_execute_data;
+ zval *offset;
+
+ memset(&fake_execute_data, 0, sizeof(fake_execute_data));
+ fake_execute_data.func = (zend_function*)&script->script.main_op_array;
+ EG(current_execute_data) = &fake_execute_data;
+ if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__",
sizeof("__COMPILER_HALT_OFFSET__") - 1)) != NULL) {
+ script->compiler_halt_offset = Z_LVAL_P(offset);
+ }
+ EG(current_execute_data) = orig_execute_data;
+ } ZEND_HASH_FOREACH_END();
+
ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL(EG(zend_constants), key, zv) {
zend_constant *c = Z_PTR_P(zv);
if (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) {