Skip to content

Commit 09614f4

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix phpGH-16256: Assertion failure in ext/soap/php_encoding.c:460
2 parents d197162 + fa52f5f commit 09614f4

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

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

@@ -2117,6 +2120,9 @@ PHP_METHOD(SoapClient, __construct)
21172120
}
21182121
if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL &&
21192122
Z_TYPE_P(tmp) == IS_ARRAY) {
2123+
if (HT_IS_PACKED(Z_ARRVAL_P(tmp))) {
2124+
php_error_docref(NULL, E_ERROR, "'classmap' option must be an associative array");
2125+
}
21202126
ZVAL_COPY(Z_CLIENT_CLASSMAP_P(this_ptr), tmp);
21212127
}
21222128

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)