From: Wez Furlong Date: Sat, 10 Sep 2005 17:47:20 +0000 (+0000) Subject: allow exceptions thrown in __sleep to interrupt the serialization process. refs PECL... X-Git-Tag: RELEASE_1_0RC1~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b0d0f7cebcb11f21e4816f2b77ee3c100da8e0b;p=php allow exceptions thrown in __sleep to interrupt the serialization process. refs PECL #5217 --- diff --git a/ext/standard/var.c b/ext/standard/var.c index 6f50ddf70b..e61e4db7ad 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -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,