summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2003-08-05 09:19:38 +0000
committerStanislav Malyshev <stas@php.net>2003-08-05 09:19:38 +0000
commitd113d32314d74c100cae2c4071e212a032c5644f (patch)
treebf124d9d1c7d6bc78df653bf688767f52fb96031
parent53bbeedc89e106facebf6831e851ccda72fa2705 (diff)
downloadphp-git-d113d32314d74c100cae2c4071e212a032c5644f.tar.gz
Don't try to __sleep incomplete classes
-rw-r--r--ext/standard/var.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 0a79926cb9..33e73d351e 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -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 (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(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.");
+ }
+
+ zval_ptr_dtor(&retval_ptr);
}
-
- zval_ptr_dtor(&retval_ptr);
+ return;
}
- return;
}
+
if (retval_ptr)
zval_ptr_dtor(&retval_ptr);
/* fall-through */