[php-src] PHP-8.3: Fix GHSA-4646-p932-gw34: keep SOAP DTD alive during cleanup

From: Date: Thu, 19 Nov 2026 15:26:21 +0000
Subject: [php-src] PHP-8.3: Fix GHSA-4646-p932-gw34: keep SOAP DTD alive during cleanup
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143905@lists.php.net to get a copy of this message
Author: Jakub Zelenka (bukka) Date: 2026-11-19T16:08:08+01:00 Commit: https://github.com/php/php-src/commit/13a0f8c8c1634d80de1a42016390b1bc3bd6e470 Raw diff: https://github.com/php/php-src/commit/13a0f8c8c1634d80de1a42016390b1bc3bd6e470.diff Fix GHSA-4646-p932-gw34: keep SOAP DTD alive during cleanup Changed paths: A ext/soap/tests/GHSA-4646-p932-gw34.phpt M ext/soap/php_xml.c Diff: diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c index 340dbd8ea4ae..a692ba8dcdc0 100644 --- a/ext/soap/php_xml.c +++ b/ext/soap/php_xml.c @@ -50,6 +50,9 @@ static void cleanup_xml_node(xmlNodePtr node) xmlUnlinkNode(trav); xmlFreeNode(trav); } + } else if (trav->type == XML_DTD_NODE) { + /* Attribute-value entity references can share content with the DTD. + * Keep it alive until the document itself is freed. */ } else if ((trav->type != XML_ELEMENT_NODE) && (trav->type != XML_CDATA_SECTION_NODE)) { xmlUnlinkNode(trav); diff --git a/ext/soap/tests/GHSA-4646-p932-gw34.phpt b/ext/soap/tests/GHSA-4646-p932-gw34.phpt new file mode 100644 index 000000000000..8e3567d9660a --- /dev/null +++ b/ext/soap/tests/GHSA-4646-p932-gw34.phpt @@ -0,0 +1,35 @@ +--TEST-- +GHSA-4646-p932-gw34: DTD entity references must not outlive their declarations +--POST-- +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE Envelope [<!ENTITY e "boom">]> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:ns1="urn:t"> + <SOAP-ENV:Header> + <h SOAP-ENV:actor="&e;" SOAP-ENV:mustUnderstand="1"/> + </SOAP-ENV:Header> + <SOAP-ENV:Body> + <ns1:echo_><param0 xsi:type="xsd:string">x</param0></ns1:echo_> + </SOAP-ENV:Body> +</SOAP-ENV:Envelope> +--EXTENSIONS-- +soap +--FILE-- +<?php +function echo_($x) { + return $x; +} + +$server = new SoapServer(null, [ + 'uri' => 'urn:t', + 'style' => SOAP_RPC, + 'use' => SOAP_ENCODED, +]); +$server->addFunction('echo_'); +$server->handle(); +?> +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>DTD are not supported by SOAP</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

« previous php.cvs (#143905) next »