Skip to content

Commit 2dbc605

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-16256: Assertion failure in ext/soap/php_encoding.c:460
2 parents bd8495e + 922b9d6 commit 2dbc605

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ PHP NEWS
8181
(nielsdos)
8282
. Fixed bug GH-16237 (Segmentation fault when cloning SoapServer). (nielsdos)
8383
. Fix Soap leaking http_msg on error. (nielsdos)
84+
. Fixed bug GH-16256 (Assertion failure in ext/soap/php_encoding.c:460).
85+
(nielsdos)
8486

8587
- SPL:
8688
. Fixed bug GH-15918 (Assertion failure in ext/spl/spl_fixedarray.c).

ext/soap/soap.c

+6
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,9 @@ PHP_METHOD(SoapServer, __construct)
838838

839839
if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL &&
840840
Z_TYPE_P(tmp) == IS_ARRAY) {
841+
if (HT_IS_PACKED(Z_ARRVAL_P(tmp))) {
842+
php_error_docref(NULL, E_ERROR, "'classmap' option must be an associative array");
843+
}
841844
service->class_map = zend_array_dup(Z_ARRVAL_P(tmp));
842845
}
843846

@@ -2004,6 +2007,9 @@ PHP_METHOD(SoapClient, __construct)
20042007
}
20052008
if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL &&
20062009
Z_TYPE_P(tmp) == IS_ARRAY) {
2010+
if (HT_IS_PACKED(Z_ARRVAL_P(tmp))) {
2011+
php_error_docref(NULL, E_ERROR, "'classmap' option must be an associative array");
2012+
}
20072013
ZVAL_COPY(Z_CLIENT_CLASSMAP_P(this_ptr), tmp);
20082014
}
20092015

ext/soap/tests/bugs/gh16256.phpt

+25
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)