Skip to content

Commit fa52f5f

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16256: Assertion failure in ext/soap/php_encoding.c:460
2 parents 589da5b + 2dbc605 commit fa52f5f

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ PHP NEWS
9797
- SOAP:
9898
. Fixed bug GH-16237 (Segmentation fault when cloning SoapServer). (nielsdos)
9999
. Fix Soap leaking http_msg on error. (nielsdos)
100+
. Fixed bug GH-16256 (Assertion failure in ext/soap/php_encoding.c:460).
101+
(nielsdos)
100102

101103
- Standard:
102104
. Fixed bug GH-16053 (Assertion failure in Zend/zend_hash.c). (Arnaud)

ext/soap/soap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,9 @@ PHP_METHOD(SoapServer, __construct)
955955

956956
if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL &&
957957
Z_TYPE_P(tmp) == IS_ARRAY) {
958+
if (HT_IS_PACKED(Z_ARRVAL_P(tmp))) {
959+
php_error_docref(NULL, E_ERROR, "'classmap' option must be an associative array");
960+
}
958961
service->class_map = zend_array_dup(Z_ARRVAL_P(tmp));
959962
}
960963

@@ -2114,6 +2117,9 @@ PHP_METHOD(SoapClient, __construct)
21142117
}
21152118
if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL &&
21162119
Z_TYPE_P(tmp) == IS_ARRAY) {
2120+
if (HT_IS_PACKED(Z_ARRVAL_P(tmp))) {
2121+
php_error_docref(NULL, E_ERROR, "'classmap' option must be an associative array");
2122+
}
21172123
ZVAL_COPY(Z_CLIENT_CLASSMAP_P(this_ptr), tmp);
21182124
}
21192125

ext/soap/tests/bugs/gh16256.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
GH-16256 (Assertion failure in ext/soap/php_encoding.c:460)
3+
--EXTENSIONS--
4+
soap
5+
--FILE--
6+
<?php
7+
$classmap = [
8+
"bogus",
9+
];
10+
$wsdl = __DIR__."/ext/soap/tests/bug41004.wsdl";
11+
try {
12+
new SoapClient($wsdl, ["classmap" => $classmap]);
13+
} catch (Throwable $e) {
14+
echo $e->getMessage(), "\n";
15+
}
16+
try {
17+
new SoapServer($wsdl, ["classmap" => $classmap]);
18+
} catch (Throwable $e) {
19+
echo $e->getMessage(), "\n";
20+
}
21+
?>
22+
--EXPECT--
23+
SoapClient::__construct(): 'classmap' option must be an associative array
24+
<?xml version="1.0" encoding="UTF-8"?>
25+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SoapServer::__construct(): 'classmap' option must be an associative array</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

0 commit comments

Comments
 (0)