Skip to content

Fix missing error restore code in ext-soap #14379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PHP NEWS

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

- Sodium:
. Fix memory leaks in ext/sodium on failure of some functions. (nielsdos)
Expand Down
12 changes: 8 additions & 4 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,11 +899,9 @@ PHP_METHOD(SoapServer, setPersistence)
zend_argument_value_error(
1, "must be either SOAP_PERSISTENCE_SESSION or SOAP_PERSISTENCE_REQUEST when the SOAP server is used in class mode"
);
RETURN_THROWS();
}
} else {
zend_throw_error(NULL, "SoapServer::setPersistence(): Persistence cannot be set when the SOAP server is used in function mode");
RETURN_THROWS();
}

SOAP_SERVER_END_CODE();
Expand Down Expand Up @@ -1042,13 +1040,15 @@ PHP_METHOD(SoapServer, addFunction)

if (Z_TYPE_P(tmp_function) != IS_STRING) {
zend_argument_type_error(1, "must contain only strings");
SOAP_SERVER_END_CODE();
RETURN_THROWS();
}

key = zend_string_tolower(Z_STR_P(tmp_function));

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

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

if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) {
zend_argument_type_error(1, "must be a valid function name, function \"%s\" not found", Z_STRVAL_P(function_name));
SOAP_SERVER_END_CODE();
RETURN_THROWS();
}
if (service->soap_functions.ft == NULL) {
Expand All @@ -1086,11 +1087,9 @@ PHP_METHOD(SoapServer, addFunction)
service->soap_functions.functions_all = TRUE;
} else {
zend_argument_value_error(1, "must be SOAP_FUNCTIONS_ALL when an integer is passed");
RETURN_THROWS();
}
} else {
zend_argument_type_error(1, "must be of type array|string|int, %s given", zend_zval_type_name(function_name));
RETURN_THROWS();
}

SOAP_SERVER_END_CODE();
Expand Down Expand Up @@ -1150,6 +1149,7 @@ PHP_METHOD(SoapServer, handle)

if (arg && ZEND_SIZE_T_INT_OVFL(arg_len)) {
soap_server_fault("Server", "Input string is too long", NULL, NULL, NULL);
SOAP_SERVER_END_CODE();
return;
}

Expand Down Expand Up @@ -1231,10 +1231,12 @@ PHP_METHOD(SoapServer, handle)
php_stream_filter_append(&SG(request_info).request_body->readfilters, zf);
} else {
php_error_docref(NULL, E_WARNING,"Can't uncompress compressed request");
SOAP_SERVER_END_CODE();
return;
}
} else {
php_error_docref(NULL, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_P(encoding));
SOAP_SERVER_END_CODE();
return;
}
}
Expand All @@ -1246,6 +1248,7 @@ PHP_METHOD(SoapServer, handle)
}
} else {
zval_ptr_dtor(&retval);
SOAP_SERVER_END_CODE();
return;
}
} else {
Expand Down Expand Up @@ -1622,6 +1625,7 @@ PHP_METHOD(SoapServer, addSoapHeader)

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

Expand Down
Loading