mirror of
https://github.com/php/php-src.git
synced 2026-04-13 11:02:55 +02:00
Don't try to __sleep incomplete classes
This commit is contained in:
@@ -550,26 +550,29 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
|
||||
zval fname;
|
||||
int res;
|
||||
|
||||
INIT_PZVAL(&fname);
|
||||
ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 0);
|
||||
res = call_user_function_ex(CG(function_table), struc, &fname,
|
||||
&retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
|
||||
if(Z_OBJCE_PP(struc) != PHP_IC_ENTRY) {
|
||||
INIT_PZVAL(&fname);
|
||||
ZVAL_STRINGL(&fname, "__sleep", sizeof("__sleep") - 1, 0);
|
||||
res = call_user_function_ex(CG(function_table), struc, &fname,
|
||||
&retval_ptr, 0, 0, 1, NULL TSRMLS_CC);
|
||||
|
||||
if (res == SUCCESS) {
|
||||
if (retval_ptr) {
|
||||
if (HASH_OF(retval_ptr)) {
|
||||
php_var_serialize_class(buf, struc, retval_ptr,
|
||||
var_hash TSRMLS_CC);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
|
||||
"containing the names of instance-variables to "
|
||||
"serialize.");
|
||||
if (res == SUCCESS) {
|
||||
if (retval_ptr) {
|
||||
if (HASH_OF(retval_ptr)) {
|
||||
php_var_serialize_class(buf, struc, retval_ptr,
|
||||
var_hash TSRMLS_CC);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "__sleep should return an array only "
|
||||
"containing the names of instance-variables to "
|
||||
"serialize.");
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (retval_ptr)
|
||||
zval_ptr_dtor(&retval_ptr);
|
||||
/* fall-through */
|
||||
|
||||
Reference in New Issue
Block a user