xref: /php-src/ext/soap/tests/bugs/bug36999.phpt (revision 8b561d33)
1--TEST--
2Bug #36999 (xsd:long values clamped to LONG_MAX instead of using double)
3--EXTENSIONS--
4soap
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9
10function echoLong($num) {
11  return $num;
12}
13
14class LocalSoapClient extends SoapClient {
15  private $server;
16
17  function __construct($wsdl) {
18    parent::__construct($wsdl);
19    $this->server = new SoapServer($wsdl);
20    $this->server->addFunction('echoLong');
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
33$soap = new LocalSoapClient(__DIR__."/bug36999.wsdl");
34
35function test($num) {
36  global $soap;
37  try {
38      printf("%s %0.0f\n", gettype($num), $num);
39      $ret = $soap->echoLong($num);
40      printf("%s %0.0f\n", gettype($ret), $ret);
41    } catch (SoapFault $ex) {
42      var_dump($ex);
43    }
44}
45test(3706790240);
46?>
47--EXPECTF--
48%s 3706790240
49%s 3706790240
50