xref: /php-src/ext/soap/tests/bugs/bug38055.phpt (revision 8b561d33)
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  private $server;
18
19  function __construct($wsdl) {
20    parent::__construct($wsdl);
21    $this->server = new SoapServer($wsdl);
22    $this->server->addFunction('Test');
23  }
24
25  function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
26    ob_start();
27    $this->server->handle($request);
28    $response = ob_get_contents();
29    ob_end_clean();
30    return $response;
31  }
32}
33
34$client = new TestSoapClient(__DIR__.'/bug38055.wsdl');
35$boolA = 1;
36$boolB = '1';
37$res = $client->Test(array('boolA'=>$boolA, 'boolB'=>$boolB));
38var_dump($g1);
39var_dump($g2);
40?>
41--EXPECT--
42bool(true)
43bool(true)
44