1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/soap/tests/gh16318.phpt
Niels Dossche 6ff4a2d7a8 Fix GH-16318: Recursive array segfaults soap encoding
This adds recursion protection to the array encoders.

Closes GH-16347.
2024-10-12 23:20:15 +02:00

37 lines
896 B
PHP

--TEST--
GH-16318 (Recursive array segfaults soap encoding)
--EXTENSIONS--
soap
--FILE--
<?php
// SOAP-ENC array
$tmp =& $test1;
$test1[] = $tmp;
// map array
$test2 = [];
$test2["a"] = "a";
$test2[] =& $test2;
class TestSoapClient extends SoapClient {
public function __doRequest(string $request, string $location, string $action, int $version, bool $oneWay = false): ?string
{
die($request);
}
}
$client = new TestSoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0));
foreach ([$test1, $test2] as $test) {
try {
$client->__soapCall("echoStructArray", array($test), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/"));
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
}
?>
--EXPECT--
Recursive array cannot be encoded
Recursive array cannot be encoded