]> granicus.if.org Git - php/commitdiff
Don't try to __sleep incomplete classes
authorStanislav Malyshev <stas@php.net>
Tue, 5 Aug 2003 09:19:38 +0000 (09:19 +0000)
committerStanislav Malyshev <stas@php.net>
Tue, 5 Aug 2003 09:19:38 +0000 (09:19 +0000)
ext/standard/var.c

index 0a79926cb944fa635398dbf5c7ad20134926722f..33e73d351e2b55a7be732e89e9f956d99aefaa6d 100644 (file)
@@ -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 */