xref: /PHP-8.1/ext/soap/tests/bugs/bug38055.phpt (revision 8ae4b560)
1--TEST--
2Bug #38055 (Wrong interpretation of boolean parameters)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9function Test($param) {
10    global $g1, $g2;
11    $g1 = $param->boolA;
12    $g2	= $param->boolB;
13    return 1;
14}
15
16class TestSoapClient extends SoapClient {
17  function __construct($wsdl) {
18    parent::__construct($wsdl);
19    $this->server = new SoapServer($wsdl);
20    $this->server->addFunction('Test');
21  }
22
23  function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
24    ob_start();
25    $this->server->handle($request);
26    $response = ob_get_contents();
27    ob_end_clean();
28    return $response;
29  }
30}
31
32$client = new TestSoapClient(__DIR__.'/bug38055.wsdl');
33$boolA = 1;
34$boolB = '1';
35$res = $client->Test(array('boolA'=>$boolA, 'boolB'=>$boolB));
36var_dump($g1);
37var_dump($g2);
38?>
39--EXPECT--
40bool(true)
41bool(true)
42