Skip to content

Commit 5ce6d2f

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Remember __COMPILER_HALT_OFFSET__(s) in preloaded scripts
2 parents 0a66d82 + 4f2ad75 commit 5ce6d2f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,6 +3933,22 @@ static int accel_preload(const char *config)
39333933
if (EG(zend_constants)) {
39343934
zend_string *key;
39353935
zval *zv;
3936+
3937+
/* Remember __COMPILER_HALT_OFFSET__(s) */
3938+
ZEND_HASH_FOREACH_PTR(preload_scripts, script) {
3939+
zend_execute_data *orig_execute_data = EG(current_execute_data);
3940+
zend_execute_data fake_execute_data;
3941+
zval *offset;
3942+
3943+
memset(&fake_execute_data, 0, sizeof(fake_execute_data));
3944+
fake_execute_data.func = (zend_function*)&script->script.main_op_array;
3945+
EG(current_execute_data) = &fake_execute_data;
3946+
if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1)) != NULL) {
3947+
script->compiler_halt_offset = Z_LVAL_P(offset);
3948+
}
3949+
EG(current_execute_data) = orig_execute_data;
3950+
} ZEND_HASH_FOREACH_END();
3951+
39363952
ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL(EG(zend_constants), key, zv) {
39373953
zend_constant *c = Z_PTR_P(zv);
39383954
if (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) {

0 commit comments

Comments
 (0)