diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index eb35cfc72650..3bba56782f3b 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -4284,6 +4284,10 @@ static sdlFunctionPtr get_doc_function(sdlPtr sdl, xmlNodePtr params) /* {{{ */
xmlNodePtr node = params;
ZEND_HASH_FOREACH_PTR(tmp->requestParameters, param) {
+ if (node == NULL) {
+ ok = 0;
+ break;
+ }
if (param->element) {
if (strcmp(param->element->name, (char*)node->name) != 0) {
ok = 0;
diff --git a/ext/soap/tests/gh25094.phpt b/ext/soap/tests/gh25094.phpt
new file mode 100644
index 000000000000..59ad67d8789c
--- /dev/null
+++ b/ext/soap/tests/gh25094.phpt
@@ -0,0 +1,29 @@
+--TEST--
+GH-25094 (NULL pointer dereference in get_doc_function() when the request has fewer parts than the WSDL)
+--CREDITS--
+cxxz16
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+setClass('TestService');
+
+$server->handle(<<<'XML'
+
+
+ foo
+
+XML);
+?>
+--EXPECT--
+
+SOAP-ENV:ServerProcedure 'a' not present
diff --git a/ext/soap/tests/gh25094.wsdl b/ext/soap/tests/gh25094.wsdl
new file mode 100644
index 000000000000..b7865b2db582
--- /dev/null
+++ b/ext/soap/tests/gh25094.wsdl
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+