xref: /PHP-7.4/ext/soap/tests/bugs/bug36999.phpt (revision 26dfce7f)
1--TEST--
2Bug #36999 (xsd:long values clamped to LONG_MAX instead of using double)
3--SKIPIF--
4<?php
5  if (!extension_loaded('soap')) die('skip soap extension not available');
6?>
7--INI--
8soap.wsdl_cache_enabled=0
9--FILE--
10<?php
11
12function echoLong($num) {
13  return $num;
14}
15
16class LocalSoapClient extends SoapClient {
17
18  function __construct($wsdl) {
19    parent::__construct($wsdl);
20    $this->server = new SoapServer($wsdl);
21    $this->server->addFunction('echoLong');
22  }
23
24  function __doRequest($request, $location, $action, $version, $one_way = 0) {
25    ob_start();
26    $this->server->handle($request);
27    $response = ob_get_contents();
28    ob_end_clean();
29    return $response;
30  }
31
32}
33
34$soap = new LocalSoapClient(__DIR__."/bug36999.wsdl");
35
36function test($num) {
37  global $soap;
38  try {
39	  printf("%s %0.0f\n", gettype($num), $num);
40	  $ret = $soap->echoLong($num);
41	  printf("%s %0.0f\n", gettype($ret), $ret);
42	} catch (SoapFault $ex) {
43	  var_dump($ex);
44	}
45}
46test(3706790240);
47?>
48--EXPECTF--
49%s 3706790240
50%s 3706790240
51