]> granicus.if.org Git - php/commitdiff
allow exceptions thrown in __sleep to interrupt the serialization process. refs PECL...
authorWez Furlong <wez@php.net>
Sat, 10 Sep 2005 17:47:20 +0000 (17:47 +0000)
committerWez Furlong <wez@php.net>
Sat, 10 Sep 2005 17:47:20 +0000 (17:47 +0000)
ext/standard/var.c

index 6f50ddf70bd76fc90b06d57e11f3d91fec8075de..e61e4db7ad0349c10a34a0b749957ad8a6140e36 100644 (file)
@@ -711,13 +711,20 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
                                }
                                
                                if (ce && ce != PHP_IC_ENTRY &&
-                                   zend_hash_exists(&ce->function_table, "__sleep", sizeof("__sleep"))) {
+                                               zend_hash_exists(&ce->function_table, "__sleep", sizeof("__sleep"))) {
                                        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 (EG(exception)) {
+                                                       /* allow exceptions to bubble up */
+                                                       if (retval_ptr) {
+                                                               zval_ptr_dtor(&retval_ptr);
+                                                       }
+                                                       return;
+                                               }
                                                if (retval_ptr) {
                                                        if (HASH_OF(retval_ptr)) {
                                                                php_var_serialize_class(buf, struc, retval_ptr,