diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 2b6a32d3265f..0bbf13a6c282 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -3460,13 +3460,15 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c
}
}
- if (function && function->binding && function->binding->bindingType == BINDING_SOAP) {
- sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
- if (fnb->style == SOAP_RPC) {
+ if (func != NULL) {
+ if (function && function->binding && function->binding->bindingType == BINDING_SOAP) {
+ sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
+ if (fnb->style == SOAP_RPC) {
+ func = func->children;
+ }
+ } else {
func = func->children;
}
- } else {
- func = func->children;
}
deserialize_parameters(func, function, num_params, parameters);
diff --git a/ext/soap/tests/empty_body_soapaction.phpt b/ext/soap/tests/empty_body_soapaction.phpt
new file mode 100644
index 000000000000..93102c739c7e
--- /dev/null
+++ b/ext/soap/tests/empty_body_soapaction.phpt
@@ -0,0 +1,33 @@
+--TEST--
+SoapServer: empty Body with SOAPAction must not crash (RPC)
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--SKIPIF--
+
+--POST--
+
+
+
+
+--FILE--
+ WSDL_CACHE_NONE,
+]);
+$server->setClass(T::class);
+$_SERVER['HTTP_SOAPACTION'] = '"Test"';
+$server->handle();
+?>
+--EXPECT--
+
+ok