diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-04 16:27:45 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-04 16:27:45 +0200 |
commit | 21a9ad910bc1a890ca4bddc4d4239c2e17d4c6a6 (patch) | |
tree | 0de7f5caf07ebdf5f71c7773587c3ff59f06e8db /Zend/zend_inheritance.c | |
parent | 733d84dbdf8f278fc0060a4fb5b2766c035c3b1f (diff) | |
download | php-git-21a9ad910bc1a890ca4bddc4d4239c2e17d4c6a6.tar.gz |
Fixed bug #79548
When duplicating user functions with static variables, make sure
that we init a new map ptr slot for the static variables.
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r-- | Zend/zend_inheritance.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 6bd35a6bb7..e7dcf54e0d 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -86,7 +86,14 @@ static zend_function *zend_duplicate_user_function(zend_function *func) /* {{{ * if (!(GC_FLAGS(new_function->op_array.static_variables) & IS_ARRAY_IMMUTABLE)) { GC_ADDREF(new_function->op_array.static_variables); } - ZEND_MAP_PTR_INIT(new_function->op_array.static_variables_ptr, &new_function->op_array.static_variables); + + if (CG(compiler_options) & ZEND_COMPILE_PRELOAD) { + ZEND_ASSERT(new_function->op_array.fn_flags & ZEND_ACC_PRELOADED); + ZEND_MAP_PTR_NEW(new_function->op_array.static_variables_ptr); + } else { + ZEND_MAP_PTR_INIT(new_function->op_array.static_variables_ptr, &new_function->op_array.static_variables); + } + return new_function; } /* }}} */ |