Commit e6a0bd182a5 for php
commit e6a0bd182a5f2bec628f1e1f89d69ff78051bd5a
Merge: 8c4fa332456 f58a4b853f5
Author: Jakub Zelenka <bukka@php.net>
Date: Mon Nov 30 22:27:25 2026 +0100
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/soap: fix DTD node being matched as an element
diff --cc NEWS
index 19324a39fd4,cf825696a91..55605a2ba7d
--- a/NEWS
+++ b/NEWS
@@@ -246,8 -259,12 +246,10 @@@ PH
- SOAP:
. Fixed bug GH-25267 (NULL dereference in to_xml_any() with integer key).
(lazerg)
- . Fixed bug GH-25094 (NULL dereference in get_doc_function() with missing
- parts). (lazerg)
- . Fixed SOAP error handler dropping a custom HTTP status line on a non-fatal
- error. (lacatoire)
+ . Fixed NULL dereference in SoapServer::handle() with an empty Body and a
+ SOAPAction matching an RPC operation. (Jorg Sowa)
+ . Fixed bug GH-25628 (SOAP crashes when importing the XMLDSIG schema).
+ (Jakub Zelenka, ndossche)
- Sockets:
. Fixed bug GH-25530 (socket_last_error() without a socket returns an error
diff --cc ext/soap/php_xml.c
index 35498046f24,4ff938d4be2..7e8e91dce18
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.c
@@@ -220,8 -274,12 +220,12 @@@ int attr_is_equal_ex(xmlAttrPtr node, c
return FALSE;
}
-int node_is_equal_ex(xmlNodePtr node, char *name, char *ns)
+int node_is_equal_ex(xmlNodePtr node, const char *name, const char *ns)
{
+ /* A DTD node can carry the same name but is not an xmlNode. */
+ if (node->type != XML_ELEMENT_NODE) {
+ return FALSE;
+ }
if (name == NULL || ((node->name) && strcmp((char*)node->name, name) == 0)) {
if (ns) {
xmlNsPtr nsPtr = node_find_ns(node);
diff --cc ext/soap/tests/dtd_named_like_root_request.phpt
index 00000000000,9078c028baa..d01736c54ba
mode 000000,100644..100644
--- a/ext/soap/tests/dtd_named_like_root_request.phpt
+++ b/ext/soap/tests/dtd_named_like_root_request.phpt
@@@ -1,0 -1,27 +1,27 @@@
+ --TEST--
+ SOAP: DOCTYPE named like the envelope is not taken for it when rejecting a request
+ --EXTENSIONS--
+ soap
+ --FILE--
+ <?php
+ function test($x) {
+ return $x;
+ }
+
+ $request = <<<XML
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE Envelope [<!NOTATION n SYSTEM "x">]>
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:test">
+ <env:Body>
+ <ns1:test><param0>x</param0></ns1:test>
+ </env:Body>
+ </env:Envelope>
+ XML;
+
+ $server = new SoapServer(null, ['uri' => 'urn:test']);
+ $server->addFunction('test');
+ $server->handle($request);
+ ?>
+ --EXPECT--
+ <?xml version="1.0" encoding="UTF-8"?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>DTD are not supported by SOAP</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
++<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text xml:lang="en">DTD are not supported by SOAP</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>