bug48557.phpt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. --TEST--
  2. Bug #48557 (Numeric string keys in Apache Hashmaps are not cast to integers)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. error_reporting(E_ALL);
  8. ini_set('display_errors', 1);
  9. ini_set("soap.wsdl_cache_enabled", 0);
  10. function test($map) {
  11. var_dump($map, $map[1], $map[2]);die;
  12. }
  13. $y = new SoapServer(__DIR__ . '/bug48557.wsdl');
  14. $y->addfunction("test");
  15. $request = <<<XML
  16. <?xml version="1.0"?>
  17. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  18. <SOAP-ENV:Body>
  19. <ns1:test>
  20. <testParam xsi:type="ns2:Map">
  21. <item>
  22. <key xsi:type="xsd:int">1</key>
  23. <value xsi:type="xsd:int">123</value>
  24. </item>
  25. <item>
  26. <key xsi:type="xsd:int">-1000</key>
  27. <value xsi:type="xsd:string">123</value>
  28. </item>
  29. <item>
  30. <key xsi:type="xsd:string">2</key>
  31. <value xsi:type="xsd:float">123.5</value>
  32. </item>
  33. <item>
  34. <key xsi:type="xsd:string">-2000</key>
  35. <value xsi:type="xsd:float">123.5</value>
  36. </item>
  37. <item>
  38. <key xsi:type="xsd:string">011</key>
  39. <value xsi:type="xsd:float">123.5</value>
  40. </item>
  41. <item>
  42. <key xsi:type="xsd:int">012</key>
  43. <value xsi:type="xsd:float">123.5</value>
  44. </item>
  45. </testParam>
  46. </ns1:test>
  47. </SOAP-ENV:Body>
  48. </SOAP-ENV:Envelope>
  49. XML;
  50. $y->handle($request);
  51. ?>
  52. ===DONE===
  53. --EXPECT--
  54. array(6) {
  55. [1]=>
  56. int(123)
  57. [-1000]=>
  58. string(3) "123"
  59. [2]=>
  60. float(123.5)
  61. [-2000]=>
  62. float(123.5)
  63. ["011"]=>
  64. float(123.5)
  65. [12]=>
  66. float(123.5)
  67. }
  68. int(123)
  69. float(123.5)