Skip to content

Commit 9659f3e

Browse files
committed
Check for __unserialize pointer first
As the check is cheaper and this is what the deprecation for __sleep() does
1 parent 49fdf49 commit 9659f3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9355,7 +9355,7 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
93559355
zend_error(E_DEPRECATED, "The __sleep() serialization magic method has been deprecated."
93569356
" Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)");
93579357
}
9358-
if (UNEXPECTED(zend_hash_exists(&ce->function_table, ZSTR_KNOWN(ZEND_STR_WAKEUP)) && ce->__unserialize == NULL)) {
9358+
if (ce->__unserialize == NULL && zend_hash_exists(&ce->function_table, ZSTR_KNOWN(ZEND_STR_WAKEUP))) {
93599359
zend_error(E_DEPRECATED, "The __wakeup() serialization magic method has been deprecated."
93609360
" Implement __unserialize() instead (or in addition, if support for old PHP versions is necessary)");
93619361
}

0 commit comments

Comments
 (0)