Skip to content

Commit 6aa66e0

Browse files
authored
Fix missing error restore code in ext-soap (#14379)
The begin and end macros should be paired, but some of the end macro calls were missing.
1 parent d7aa0be commit 6aa66e0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ PHP NEWS
2828

2929
- Soap:
3030
. Fixed bug #47925 (PHPClient can't decompress response). (nielsdos)
31+
. Fix missing error restore code. (nielsdos)
3132

3233
- Sodium:
3334
. Fix memory leaks in ext/sodium on failure of some functions. (nielsdos)

ext/soap/soap.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -899,11 +899,9 @@ PHP_METHOD(SoapServer, setPersistence)
899899
zend_argument_value_error(
900900
1, "must be either SOAP_PERSISTENCE_SESSION or SOAP_PERSISTENCE_REQUEST when the SOAP server is used in class mode"
901901
);
902-
RETURN_THROWS();
903902
}
904903
} else {
905904
zend_throw_error(NULL, "SoapServer::setPersistence(): Persistence cannot be set when the SOAP server is used in function mode");
906-
RETURN_THROWS();
907905
}
908906

909907
SOAP_SERVER_END_CODE();
@@ -1042,13 +1040,15 @@ PHP_METHOD(SoapServer, addFunction)
10421040

10431041
if (Z_TYPE_P(tmp_function) != IS_STRING) {
10441042
zend_argument_type_error(1, "must contain only strings");
1043+
SOAP_SERVER_END_CODE();
10451044
RETURN_THROWS();
10461045
}
10471046

10481047
key = zend_string_tolower(Z_STR_P(tmp_function));
10491048

10501049
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) {
10511050
zend_type_error("SoapServer::addFunction(): Function \"%s\" not found", Z_STRVAL_P(tmp_function));
1051+
SOAP_SERVER_END_CODE();
10521052
RETURN_THROWS();
10531053
}
10541054

@@ -1066,6 +1066,7 @@ PHP_METHOD(SoapServer, addFunction)
10661066

10671067
if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) {
10681068
zend_argument_type_error(1, "must be a valid function name, function \"%s\" not found", Z_STRVAL_P(function_name));
1069+
SOAP_SERVER_END_CODE();
10691070
RETURN_THROWS();
10701071
}
10711072
if (service->soap_functions.ft == NULL) {
@@ -1086,11 +1087,9 @@ PHP_METHOD(SoapServer, addFunction)
10861087
service->soap_functions.functions_all = TRUE;
10871088
} else {
10881089
zend_argument_value_error(1, "must be SOAP_FUNCTIONS_ALL when an integer is passed");
1089-
RETURN_THROWS();
10901090
}
10911091
} else {
10921092
zend_argument_type_error(1, "must be of type array|string|int, %s given", zend_zval_type_name(function_name));
1093-
RETURN_THROWS();
10941093
}
10951094

10961095
SOAP_SERVER_END_CODE();
@@ -1150,6 +1149,7 @@ PHP_METHOD(SoapServer, handle)
11501149

11511150
if (arg && ZEND_SIZE_T_INT_OVFL(arg_len)) {
11521151
soap_server_fault("Server", "Input string is too long", NULL, NULL, NULL);
1152+
SOAP_SERVER_END_CODE();
11531153
return;
11541154
}
11551155

@@ -1231,10 +1231,12 @@ PHP_METHOD(SoapServer, handle)
12311231
php_stream_filter_append(&SG(request_info).request_body->readfilters, zf);
12321232
} else {
12331233
php_error_docref(NULL, E_WARNING,"Can't uncompress compressed request");
1234+
SOAP_SERVER_END_CODE();
12341235
return;
12351236
}
12361237
} else {
12371238
php_error_docref(NULL, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_P(encoding));
1239+
SOAP_SERVER_END_CODE();
12381240
return;
12391241
}
12401242
}
@@ -1246,6 +1248,7 @@ PHP_METHOD(SoapServer, handle)
12461248
}
12471249
} else {
12481250
zval_ptr_dtor(&retval);
1251+
SOAP_SERVER_END_CODE();
12491252
return;
12501253
}
12511254
} else {
@@ -1622,6 +1625,7 @@ PHP_METHOD(SoapServer, addSoapHeader)
16221625

16231626
if (!service || !service->soap_headers_ptr) {
16241627
zend_throw_error(NULL, "SoapServer::addSoapHeader() may be called only during SOAP request processing");
1628+
SOAP_SERVER_END_CODE();
16251629
RETURN_THROWS();
16261630
}
16271631

0 commit comments

Comments
 (0)