summaryrefslogtreecommitdiff
path: root/ext/standard/var.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-09-10 17:47:20 +0000
committerWez Furlong <wez@php.net>2005-09-10 17:47:20 +0000
commit6b0d0f7cebcb11f21e4816f2b77ee3c100da8e0b (patch)
tree383d1a7dd166986643309aa1f924fb4058af9715 /ext/standard/var.c
parent7262ccfac969295db3aa00536d72c1099504cd62 (diff)
downloadphp-git-6b0d0f7cebcb11f21e4816f2b77ee3c100da8e0b.tar.gz
allow exceptions thrown in __sleep to interrupt the serialization process. refs PECL #5217
Diffstat (limited to 'ext/standard/var.c')
-rw-r--r--ext/standard/var.c9
1 files changed, 8 insertions, 1 deletions
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,