From 04dab6086e270ad57ae5e284953f63a2887b3e94 Mon Sep 17 00:00:00 2001 From: lazerg Date: Sat, 31 Oct 2026 22:24:08 +0500 Subject: [PATCH 1/2] Fix GH-25094: NULL dereference in SOAP get_doc_function() with missing parts --- ext/soap/soap.c | 4 ++++ ext/soap/tests/gh25094.phpt | 27 +++++++++++++++++++++++++ ext/soap/tests/gh25094.wsdl | 39 +++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 ext/soap/tests/gh25094.phpt create mode 100644 ext/soap/tests/gh25094.wsdl 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..1e5a0540c8fd --- /dev/null +++ b/ext/soap/tests/gh25094.phpt @@ -0,0 +1,27 @@ +--TEST-- +GH-25094 (NULL pointer dereference in get_doc_function() when the request has fewer parts than the WSDL) +--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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 9e213bde7fa108a43314f7b2661bd29faca4137a Mon Sep 17 00:00:00 2001 From: lazerg Date: Sun, 1 Nov 2026 16:37:30 +0500 Subject: [PATCH 2/2] Add CREDITS to gh25094.phpt --- ext/soap/tests/gh25094.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/soap/tests/gh25094.phpt b/ext/soap/tests/gh25094.phpt index 1e5a0540c8fd..59ad67d8789c 100644 --- a/ext/soap/tests/gh25094.phpt +++ b/ext/soap/tests/gh25094.phpt @@ -1,5 +1,7 @@ --TEST-- GH-25094 (NULL pointer dereference in get_doc_function() when the request has fewer parts than the WSDL) +--CREDITS-- +cxxz16 --EXTENSIONS-- soap --INI--