Annotation of embedaddon/php/ext/soap/tests/bugs/bug30045.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #30045 (Cannot pass big integers (> 2147483647) in SOAP requests)
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded('soap')) die('skip soap extension not available');
! 6: if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
! 7: ?>
! 8: --INI--
! 9: soap.wsdl_cache_enabled=1
! 10: --FILE--
! 11: <?php
! 12:
! 13: function foo($type, $num) {
! 14: return new SoapVar($num, $type);
! 15: }
! 16:
! 17: class LocalSoapClient extends SoapClient {
! 18:
! 19: function __construct($wsdl, $options) {
! 20: parent::__construct($wsdl, $options);
! 21: $this->server = new SoapServer($wsdl, $options);
! 22: $this->server->addFunction('foo');
! 23: }
! 24:
! 25: function __doRequest($request, $location, $action, $version, $one_way = 0) {
! 26: $xml = simplexml_load_string($request);
! 27: echo $xml->children("http://schemas.xmlsoap.org/soap/envelope/")->Body->children("http://test-uri")->children()->param1->asXML(),"\n";
! 28: unset($xml);
! 29:
! 30: ob_start();
! 31: $this->server->handle($request);
! 32: $response = ob_get_contents();
! 33: ob_end_clean();
! 34:
! 35: return $response;
! 36: }
! 37:
! 38: }
! 39:
! 40: $soap = new LocalSoapClient(NULL, array("uri"=>"http://test-uri", "location"=>"test://"));
! 41:
! 42: function test($type, $num) {
! 43: global $soap;
! 44: try {
! 45: printf(" %0.0f\n ", $num);
! 46: $ret = $soap->foo($type, new SoapVar($num, $type));
! 47: printf(" %0.0f\n", $ret);
! 48: } catch (SoapFault $ex) {
! 49: var_dump($ex);
! 50: }
! 51: }
! 52: /*
! 53: echo "byte\n";
! 54: //test(XSD_BYTE, -129);
! 55: test(XSD_BYTE, -128);
! 56: test(XSD_BYTE, 127);
! 57: //test(XSD_BYTE, 128);
! 58:
! 59: echo "\nshort\n";
! 60: //test(XSD_SHORT, -32769);
! 61: test(XSD_SHORT, -32768);
! 62: test(XSD_SHORT, 32767);
! 63: //test(XSD_SHORT, 32768);
! 64:
! 65: echo "\nint\n";
! 66: //test(XSD_INT, -2147483649);
! 67: test(XSD_INT, -2147483648);
! 68: test(XSD_INT, 2147483647);
! 69: //test(XSD_INT, 2147483648);
! 70:
! 71: echo "\nlong\n";
! 72: //test(XSD_LONG, -9223372036854775809);
! 73: test(XSD_LONG, -9223372036854775808);
! 74: test(XSD_LONG, 9223372036854775807);
! 75: //test(XSD_LONG, 9223372036854775808);
! 76:
! 77: echo "\nunsignedByte\n";
! 78: //test(XSD_UNSIGNEDBYTE, -1);
! 79: test(XSD_UNSIGNEDBYTE, 0);
! 80: test(XSD_UNSIGNEDBYTE, 255);
! 81: //test(XSD_UNSIGNEDBYTE, 256);
! 82:
! 83: echo "\nunsignedShort\n";
! 84: //test(XSD_UNSIGNEDSHORT, -1);
! 85: test(XSD_UNSIGNEDSHORT, 0);
! 86: test(XSD_UNSIGNEDSHORT, 65535);
! 87: //test(XSD_UNSIGNEDSHORT, 65536);
! 88:
! 89: echo "\nunsignedInt\n";
! 90: //test(XSD_UNSIGNEDINT, -1);
! 91: test(XSD_UNSIGNEDINT, 0);
! 92: test(XSD_UNSIGNEDINT, 4294967295);
! 93: //test(XSD_UNSIGNEDINT, 4294967296);
! 94:
! 95: echo "\nunsignedLong\n";
! 96: //test(XSD_UNSIGNEDLONG, -1);
! 97: test(XSD_UNSIGNEDLONG, 0);
! 98: test(XSD_UNSIGNEDLONG, 18446744073709551615);
! 99: //test(XSD_UNSIGNEDLONG, 18446744073709551616);
! 100:
! 101: echo "\nnegativeInteger\n";
! 102: test(XSD_NEGATIVEINTEGER, -18446744073709551616);
! 103: test(XSD_NEGATIVEINTEGER, -1);
! 104: //test(XSD_NEGATIVEINTEGER, 0);
! 105:
! 106: echo "\nnonPositiveInteger\n";
! 107: test(XSD_NONPOSITIVEINTEGER, -18446744073709551616);
! 108: test(XSD_NONPOSITIVEINTEGER, 0);
! 109: //test(XSD_NONPOSITIVEINTEGER, 1);
! 110:
! 111: echo "\nnonNegativeInteger\n";
! 112: //test(XSD_NONNEGATIVEINTEGER, -1);
! 113: test(XSD_NONNEGATIVEINTEGER, 0);
! 114: test(XSD_NONNEGATIVEINTEGER, 18446744073709551616);
! 115:
! 116: echo "\nPositiveInteger\n";
! 117: //test(XSD_POSITIVEINTEGER, 0);
! 118: test(XSD_POSITIVEINTEGER, 1);
! 119: test(XSD_POSITIVEINTEGER, 18446744073709551616);
! 120:
! 121: echo "\ninteger\n";
! 122: test(XSD_INTEGER, -18446744073709551616);
! 123: test(XSD_INTEGER, 18446744073709551616);
! 124: */
! 125: echo "long\n";
! 126: test(XSD_LONG, 2147483647);
! 127: test(XSD_LONG, 2147483648);
! 128: test(XSD_LONG, 4294967296);
! 129: test(XSD_LONG, 8589934592);
! 130: test(XSD_LONG, 17179869184);
! 131:
! 132: echo "\nunsignedLong\n";
! 133: test(XSD_UNSIGNEDLONG, 2147483647);
! 134: test(XSD_UNSIGNEDLONG, 2147483648);
! 135: test(XSD_UNSIGNEDLONG, 4294967296);
! 136: test(XSD_UNSIGNEDLONG, 8589934592);
! 137: test(XSD_UNSIGNEDLONG, 17179869184);
! 138:
! 139: ?>
! 140: --EXPECT--
! 141: long
! 142: 2147483647
! 143: <param1 xsi:type="xsd:long">2147483647</param1>
! 144: 2147483647
! 145: 2147483648
! 146: <param1 xsi:type="xsd:long">2147483648</param1>
! 147: 2147483648
! 148: 4294967296
! 149: <param1 xsi:type="xsd:long">4294967296</param1>
! 150: 4294967296
! 151: 8589934592
! 152: <param1 xsi:type="xsd:long">8589934592</param1>
! 153: 8589934592
! 154: 17179869184
! 155: <param1 xsi:type="xsd:long">17179869184</param1>
! 156: 17179869184
! 157:
! 158: unsignedLong
! 159: 2147483647
! 160: <param1 xsi:type="xsd:unsignedLong">2147483647</param1>
! 161: 2147483647
! 162: 2147483648
! 163: <param1 xsi:type="xsd:unsignedLong">2147483648</param1>
! 164: 2147483648
! 165: 4294967296
! 166: <param1 xsi:type="xsd:unsignedLong">4294967296</param1>
! 167: 4294967296
! 168: 8589934592
! 169: <param1 xsi:type="xsd:unsignedLong">8589934592</param1>
! 170: 8589934592
! 171: 17179869184
! 172: <param1 xsi:type="xsd:unsignedLong">17179869184</param1>
! 173: 17179869184
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>