[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Ilia Alshanetsky | Date: | Sat, 07 Nov 2026 18:03:19 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143401@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-11-07T13:01:46-05:00
Commit: https://github.com/php/php-src/commit/2399bf684a3ed3e3c76282772856b8113ead32b7
Raw diff: https://github.com/php/php-src/commit/2399bf684a3ed3e3c76282772856b8113ead32b7.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix GH-25267: NULL dereference in to_xml_any() with integer key
Changed paths:
A ext/soap/tests/gh25267.phpt
M NEWS
M ext/soap/php_encoding.c
Diff:
diff --git a/NEWS b/NEWS
index 0ff604c478dc..7f6ac830240a 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,10 @@ PHP NEWS
. Fixed an exception thrown by the session_get_cb stream context callback
being replaced with a TypeError. (Ilia Alshanetsky)
+- SOAP:
+ . Fixed bug GH-25267 (NULL dereference in to_xml_any() with integer key).
+ (lazerg)
+
- Streams:
. Fixed bug GH-22063 (Stream filter chain UAF on self-removal during
callback). (Ilia Alshanetsky)
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 13ffe95cea82..8d869b6705dd 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -3240,7 +3240,7 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style,
xmlNodeP
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(data), name, el) {
ret = master_to_xml(enc, el, style, parent);
- if (ret &&
+ if (ret && name &&
ret->name != xmlStringTextNoenc) {
xmlNodeSetName(ret, BAD_CAST(ZSTR_VAL(name)));
}
diff --git a/ext/soap/tests/gh25267.phpt b/ext/soap/tests/gh25267.phpt
new file mode 100644
index 000000000000..c67411828d18
--- /dev/null
+++ b/ext/soap/tests/gh25267.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GH-25267 (NULL zend_string dereference in to_xml_any with integer key)
+--EXTENSIONS--
+soap
+--CREDITS--
+YuanchengJiang
+--FILE--
+<?php
+class C extends SoapClient {
+ function __doRequest($request, $location, $action, $version, $one_way = false, ?string
$uriParserClass = null): string {
+ echo $request;
+ return "";
+ }
+}
+$c = new C(null, ["location" => "test://", "uri" =>
"test://"]);
+$c->foo(new SoapVar([new SoapVar("y", XSD_STRING), "a" => new
SoapVar("x", XSD_STRING)], XSD_ANYXML));
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="test://" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:foo><BOGUS
xsi:type="xsd:string">y</BOGUS><a
xsi:type="xsd:string">x</a></ns1:foo></SOAP-ENV:Body></SOAP-ENV:Envelope>