bug36999.phpt 978 B

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