diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-26 10:54:40 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-26 10:54:40 +0200 |
commit | 1314ccbf8c3731f000e2c32f34dad21b053333f3 (patch) | |
tree | 06eefc0988942a2ee8201fcedc8b54dd97497bf1 /Zend/zend_API.c | |
parent | b6deace022a792ffe7139cfb82654095cfd27364 (diff) | |
download | php-git-1314ccbf8c3731f000e2c32f34dad21b053333f3.tar.gz |
Cache __unserialize() instead of unserialize()
We should use these cache slots for the new object serialization
mechanism rather than the old one.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 1d18b047d3..14075847ad 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2056,7 +2056,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio int count=0, unload=0; HashTable *target_function_table = function_table; int error_type; - zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL, *__debugInfo = NULL, *serialize_func = NULL, *unserialize_func = NULL; + zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL, *__debugInfo = NULL, *__serialize = NULL, *__unserialize = NULL; zend_string *lowercase_name; size_t fname_len; const char *lc_class_name = NULL; @@ -2222,11 +2222,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (scope) { /* Look for ctor, dtor, clone */ - if (zend_string_equals_literal(lowercase_name, "serialize")) { - serialize_func = reg_function; - } else if (zend_string_equals_literal(lowercase_name, "unserialize")) { - unserialize_func = reg_function; - } else if (ZSTR_VAL(lowercase_name)[0] != '_' || ZSTR_VAL(lowercase_name)[1] != '_') { + if (ZSTR_VAL(lowercase_name)[0] != '_' || ZSTR_VAL(lowercase_name)[1] != '_') { reg_function = NULL; } else if (zend_string_equals_literal(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME)) { ctor = reg_function; @@ -2257,6 +2253,10 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio scope->ce_flags |= ZEND_ACC_USE_GUARDS; } else if (zend_string_equals_literal(lowercase_name, ZEND_DEBUGINFO_FUNC_NAME)) { __debugInfo = reg_function; + } else if (zend_string_equals_literal(lowercase_name, "__serialize")) { + __serialize = reg_function; + } else if (zend_string_equals_literal(lowercase_name, "__unserialize")) { + __unserialize = reg_function; } else { reg_function = NULL; } @@ -2298,8 +2298,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio scope->__unset = __unset; scope->__isset = __isset; scope->__debugInfo = __debugInfo; - scope->serialize_func = serialize_func; - scope->unserialize_func = unserialize_func; + scope->__serialize = __serialize; + scope->__unserialize = __unserialize; if (ctor) { ctor->common.fn_flags |= ZEND_ACC_CTOR; if (ctor->common.fn_flags & ZEND_ACC_STATIC) { |