summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/soap/soap.c4
-rwxr-xr-xext/soap/tests/bugs/bug42151.phpt31
2 files changed, 35 insertions, 0 deletions
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index e3584b134c..1eb3abe638 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2067,6 +2067,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
#ifdef va_copy
va_list argcopy;
#endif
+ zend_object_store_bucket *old_objects;
int old = PG(display_errors);
INIT_ZVAL(outbuf);
@@ -2093,6 +2094,8 @@ static void soap_error_handler(int error_num, const char *error_filename, const
INIT_PZVAL(exception);
zend_throw_exception_object(exception TSRMLS_CC);
+ old_objects = EG(objects_store).object_buckets;
+ EG(objects_store).object_buckets = NULL;
PG(display_errors) = 0;
zend_try {
call_old_error_handler(error_num, error_filename, error_lineno, format, args);
@@ -2101,6 +2104,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
EG(in_execution) = _old_in_execution;
EG(current_execute_data) = _old_current_execute_data;
} zend_end_try();
+ EG(objects_store).object_buckets = old_objects;
PG(display_errors) = old;
zend_bailout();
} else {
diff --git a/ext/soap/tests/bugs/bug42151.phpt b/ext/soap/tests/bugs/bug42151.phpt
new file mode 100755
index 0000000000..7f7a87bd15
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42151.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #42151 __destruct functions not called after catching a SoapFault exception
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class foo {
+ function __construct(){
+ $foo = @ new SoapClient('httpx://');
+ }
+ function __destruct(){
+ echo 'I never get executed.' . "\n";
+ }
+}
+class bar {
+ function __destruct(){
+ echo 'I don\'t get executed either.' . "\n";
+ }
+}
+try {
+ $bar = new bar();
+ $foo = new foo();
+} catch (Exception $e){
+ echo $e->getMessage() . "\n";
+}
+echo "ok\n";
+?>
+--EXPECT--
+SOAP-ERROR: Parsing WSDL: Couldn't load from 'httpx://'
+ok
+I don't get executed either.