mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix static variable behavior with inheritance
When a method is inherited, the static variables will now always use the initial values, rather than the values at the time of inheritance. As such, behavior no longer depends on whether inheritance happens before or after a method has been called. This is implemented by always keeping static_variables as the original values, and static_variables_ptr as the modified copy. Closes GH-6705.
This commit is contained in:
parent
e03284739f
commit
5d160e309e
19 changed files with 97 additions and 144 deletions
|
@ -285,10 +285,10 @@ void shutdown_executor(void) /* {{{ */
|
|||
if (op_array->type == ZEND_INTERNAL_FUNCTION) {
|
||||
break;
|
||||
}
|
||||
if (op_array->static_variables) {
|
||||
if (ZEND_MAP_PTR(op_array->static_variables_ptr)) {
|
||||
HashTable *ht = ZEND_MAP_PTR_GET(op_array->static_variables_ptr);
|
||||
if (ht) {
|
||||
zend_array_release(ht);
|
||||
zend_array_destroy(ht);
|
||||
ZEND_MAP_PTR_SET(op_array->static_variables_ptr, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -308,10 +308,10 @@ void shutdown_executor(void) /* {{{ */
|
|||
zend_op_array *op_array;
|
||||
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
|
||||
if (op_array->type == ZEND_USER_FUNCTION) {
|
||||
if (op_array->static_variables) {
|
||||
if (ZEND_MAP_PTR(op_array->static_variables_ptr)) {
|
||||
HashTable *ht = ZEND_MAP_PTR_GET(op_array->static_variables_ptr);
|
||||
if (ht) {
|
||||
zend_array_release(ht);
|
||||
zend_array_destroy(ht);
|
||||
ZEND_MAP_PTR_SET(op_array->static_variables_ptr, NULL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue