summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-06-26 10:54:40 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-26 10:54:40 +0200
commit1314ccbf8c3731f000e2c32f34dad21b053333f3 (patch)
tree06eefc0988942a2ee8201fcedc8b54dd97497bf1 /Zend/zend_compile.c
parentb6deace022a792ffe7139cfb82654095cfd27364 (diff)
downloadphp-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_compile.c')
-rw-r--r--Zend/zend_compile.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f65e4a94ec..de5b8581e8 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1835,6 +1835,9 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
ce->__call = NULL;
ce->__callstatic = NULL;
ce->__tostring = NULL;
+ ce->__serialize = NULL;
+ ce->__unserialize = NULL;
+ ce->__debugInfo = NULL;
ce->create_object = NULL;
ce->get_iterator = NULL;
ce->iterator_funcs_ptr = NULL;
@@ -1849,9 +1852,6 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
ce->trait_precedences = NULL;
ce->serialize = NULL;
ce->unserialize = NULL;
- ce->serialize_func = NULL;
- ce->unserialize_func = NULL;
- ce->__debugInfo = NULL;
if (ce->type == ZEND_INTERNAL_CLASS) {
ce->info.internal.module = NULL;
ce->info.internal.builtin_functions = NULL;
@@ -6256,11 +6256,7 @@ zend_string *zend_begin_method_decl(zend_op_array *op_array, zend_string *name,
ZSTR_VAL(ce->name), ZSTR_VAL(name));
}
- if (zend_string_equals_literal(lcname, "serialize")) {
- ce->serialize_func = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, "unserialize")) {
- ce->unserialize_func = (zend_function *) op_array;
- } else if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
+ if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
/* pass */
} else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
ce->constructor = (zend_function *) op_array;
@@ -6301,8 +6297,10 @@ zend_string *zend_begin_method_decl(zend_op_array *op_array, zend_string *name,
ce->__debugInfo = (zend_function *) op_array;
} else if (zend_string_equals_literal(lcname, "__serialize")) {
zend_check_magic_method_attr(fn_flags, ce, "__serialize", 0);
+ ce->__serialize = (zend_function *) op_array;
} else if (zend_string_equals_literal(lcname, "__unserialize")) {
zend_check_magic_method_attr(fn_flags, ce, "__unserialize", 0);
+ ce->__unserialize = (zend_function *) op_array;
} else if (zend_string_equals_literal(lcname, "__set_state")) {
zend_check_magic_method_attr(fn_flags, ce, "__set_state", 1);
}