Skip to content

Commit 584aad1

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix GH-25267: NULL dereference in to_xml_any() with integer key
2 parents d405088 + 1ba316a commit 584aad1

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎NEWS‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ PHP NEWS
2727
. Fixed bug GH-16396 (Failed to invoke user error handler during index
2828
conversion in JIT). (Jorg Sowa)
2929

30+
- SOAP:
31+
. Fixed bug GH-25267 (NULL dereference in to_xml_any() with integer key).
32+
(lazerg)
33+
3034
- Streams:
3135
. Fixed bug GH-22063 (Stream filter chain UAF on self-removal during
3236
callback). (Ilia Alshanetsky)

‎ext/soap/php_encoding.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3232,7 +3232,7 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodeP
32323232

32333233
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(data), name, el) {
32343234
ret = master_to_xml(enc, el, style, parent);
3235-
if (ret &&
3235+
if (ret && name &&
32363236
ret->name != xmlStringTextNoenc) {
32373237
xmlNodeSetName(ret, BAD_CAST(ZSTR_VAL(name)));
32383238
}

‎ext/soap/tests/gh25267.phpt‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-25267 (NULL zend_string dereference in to_xml_any with integer key)
3+
--EXTENSIONS--
4+
soap
5+
--CREDITS--
6+
YuanchengJiang
7+
--FILE--
8+
<?php
9+
class C extends SoapClient {
10+
function __doRequest($request, $location, $action, $version, $one_way = false, ?string $uriParserClass = null): string {
11+
echo $request;
12+
return "";
13+
}
14+
}
15+
$c = new C(null, ["location" => "test://", "uri" => "test://"]);
16+
$c->foo(new SoapVar([new SoapVar("y", XSD_STRING), "a" => new SoapVar("x", XSD_STRING)], XSD_ANYXML));
17+
?>
18+
--EXPECT--
19+
<?xml version="1.0" encoding="UTF-8"?>
20+
<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>

0 commit comments

Comments
 (0)