]> granicus.if.org Git - php/commitdiff
Fixed bug #70469
authorAnton Artamonov <a.artmnv@gmail.com>
Sat, 4 Nov 2017 12:51:33 +0000 (19:51 +0700)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 22 Nov 2017 22:15:46 +0000 (23:15 +0100)
Don't generate an E_ERROR if we've already thrown an exception.
This interacts badly with error_get_last() checks.

NEWS
ext/soap/soap.c
ext/soap/tests/bugs/bug70469.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index a86a3bfc004c3737487c53727c66a40cf7ae7578..28eed08333bf204996b3b53185b8db54e1f8c5b7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -129,6 +129,10 @@ PHP                                                                        NEWS
 - SQLite3:
   . Updated bundled libsqlite to 3.21.0. (cmb)
 
+- Soap:
+  . Fixed bug #70469 (SoapClient generates E_ERROR even if exceptions=1 is
+    used). (Anton Artamonov)
+
 - Standard:
   . Fixed unzserialize(), to disable creation of unsupported data structures
     through manually crafted strings. (Dmitry)
index 102c784ce9717a8ba4f2ef8b8bd04581bec3b6b6..afaddf717db242cf26b77ce63505a396eb74f0b0 100644 (file)
@@ -2147,8 +2147,6 @@ static void soap_error_handler(int error_num, const char *error_filename, const
                        char buffer[1024];
                        size_t buffer_len;
                        va_list argcopy;
-                       zend_object **old_objects;
-                       int old = PG(display_errors);
 
                        va_copy(argcopy, args);
                        buffer_len = vslprintf(buffer, sizeof(buffer)-1, format, argcopy);
@@ -2165,24 +2163,6 @@ static void soap_error_handler(int error_num, const char *error_filename, const
                        add_soap_fault_ex(&fault, &SOAP_GLOBAL(error_object), code, buffer, NULL, NULL);
                        Z_ADDREF(fault);
                        zend_throw_exception_object(&fault);
-
-                       old_objects = EG(objects_store).object_buckets;
-                       EG(objects_store).object_buckets = NULL;
-                       PG(display_errors) = 0;
-                       SG(sapi_headers).http_status_line = NULL;
-                       zend_try {
-                               call_old_error_handler(error_num, error_filename, error_lineno, format, args);
-                       } zend_catch {
-                               CG(in_compilation) = _old_in_compilation;
-                               EG(current_execute_data) = _old_current_execute_data;
-                               if (SG(sapi_headers).http_status_line) {
-                                       efree(SG(sapi_headers).http_status_line);
-                               }
-                               SG(sapi_headers).http_status_line = _old_http_status_line;
-                               SG(sapi_headers).http_response_code = _old_http_response_code;
-                       } zend_end_try();
-                       EG(objects_store).object_buckets = old_objects;
-                       PG(display_errors) = old;
                        zend_bailout();
                } else if (!use_exceptions ||
                           !SOAP_GLOBAL(error_code) ||
diff --git a/ext/soap/tests/bugs/bug70469.phpt b/ext/soap/tests/bugs/bug70469.phpt
new file mode 100644 (file)
index 0000000..ca3ab80
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug #70469 (SoapClient should not generate E_ERROR if exceptions enabled)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+try {
+    $x = new SoapClient('http://i_dont_exist.com/some.wsdl');
+} catch (SoapFault $e) {
+    echo "catched\n";
+}
+
+$error = error_get_last();
+if ($error === null) {
+    echo "ok\n";
+}
+?>
+--EXPECT--
+catched
+ok
\ No newline at end of file