Skip to content

Commit 44befbd

Browse files
committed
Don't convert Error exception to SoapFault
Error exceptions should generally not be converted into domain- specific exception types. They indicate programming errors that should not be handled locally.
1 parent 018cb89 commit 44befbd

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

ext/soap/soap.c

+1-10
Original file line numberDiff line numberDiff line change
@@ -2173,16 +2173,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
21732173
ret = FALSE;
21742174
} else if (Z_TYPE_P(response) != IS_STRING) {
21752175
if (EG(exception) && instanceof_function(EG(exception)->ce, zend_ce_error)) {
2176-
zval rv;
2177-
zend_string *msg;
2178-
zval exception_object;
2179-
2180-
ZVAL_OBJ(&exception_object, EG(exception));
2181-
msg = zval_get_string(zend_read_property(zend_ce_error, Z_OBJ(exception_object), "message", sizeof("message")-1, 0, &rv));
2182-
/* change class */
2183-
EG(exception)->ce = soap_fault_class_entry;
2184-
set_soap_fault(&exception_object, NULL, "Client", ZSTR_VAL(msg), NULL, NULL, NULL);
2185-
zend_string_release_ex(msg, 0);
2176+
/* Programmer error in __doRequest() implementation, let it bubble up. */
21862177
} else if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) == NULL) {
21872178
add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL);
21882179
}

ext/soap/tests/bugs/bug54911.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ soap
1313
$client->__soapCall('', array());
1414
?>
1515
--EXPECTF--
16-
Fatal error: Uncaught SoapFault exception: [Client] Access to undeclared static property XSoapClient::$crash in %sbug54911.php:4
16+
Fatal error: Uncaught Error: Access to undeclared static property XSoapClient::$crash in %sbug54911.php:4
1717
Stack trace:
1818
#0 [internal function]: XSoapClient->__doRequest('<?xml version="...', '', '#', 1, false)
1919
#1 %sbug54911.php(8): SoapClient->__soapCall('', Array)

0 commit comments

Comments
 (0)