22PHPC-592: Property name corrupted when unserializing 64-bit integer on 32-bit platform
33--SKIPIF--
44<?php if (4 !== PHP_INT_SIZE ) { die ('skip Only for 32-bit platform ' ); } ?>
5- --INI--
6- mongodb.debug=stderr
75--FILE--
86<?php
97
@@ -24,15 +22,19 @@ $tests = [
2422
2523foreach ($ tests as $ json ) {
2624 printf ("Test %s \n" , $ json );
27- var_dump (toPHP (fromJSON ($ json )));
25+ try {
26+ $ encoded = toPHP (fromJSON ($ json ));
27+ var_dump ( $ encoded );
28+ } catch ( MongoDB \Driver \Exception \InvalidArgumentException $ e ) {
29+ echo "MongoDB\Driver\Exception\InvalidArgumentException: " , $ e ->getMessage (), "\n" ;
30+ }
2831 echo "\n" ;
2932}
3033
3134?>
3235===DONE===
3336<?php exit (0 ); ?>
3437--EXPECTF--
35- %a
3638Test { "x": { "$numberLong": "-2147483648" }}
3739object(stdClass)#%d (%d) {
3840 ["x"]=>
@@ -46,25 +48,13 @@ object(stdClass)#%d (%d) {
4648}
4749
4850Test { "x": { "$numberLong": "4294967294" }}
49- [%s] PHONGO-BSON: WARNING > Integer overflow detected on your platform: 4294967294
50- object(stdClass)#%d (%d) {
51- ["x"]=>
52- string(10) "4294967294"
53- }
51+ MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 4294967294
5452
5553Test { "x": { "$numberLong": "4294967295" }}
56- [%s] PHONGO-BSON: WARNING > Integer overflow detected on your platform: 4294967295
57- object(stdClass)#%d (%d) {
58- ["x"]=>
59- string(10) "4294967295"
60- }
54+ MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 4294967295
6155
6256Test { "x": { "$numberLong": "9223372036854775807" }}
63- [%s] PHONGO-BSON: WARNING > Integer overflow detected on your platform: 9223372036854775807
64- object(stdClass)#%d (%d) {
65- ["x"]=>
66- string(19) "9223372036854775807"
67- }
57+ MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 9223372036854775807
6858
6959Test { "longFieldName": { "$numberLong": "-2147483648" }}
7060object(stdClass)#%d (%d) {
@@ -79,24 +69,12 @@ object(stdClass)#%d (%d) {
7969}
8070
8171Test { "longFieldName": { "$numberLong": "4294967294" }}
82- [%s] PHONGO-BSON: WARNING > Integer overflow detected on your platform: 4294967294
83- object(stdClass)#%d (%d) {
84- ["longFieldName"]=>
85- string(10) "4294967294"
86- }
72+ MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 4294967294
8773
8874Test { "longFieldName": { "$numberLong": "4294967295" }}
89- [%s] PHONGO-BSON: WARNING > Integer overflow detected on your platform: 4294967295
90- object(stdClass)#%d (%d) {
91- ["longFieldName"]=>
92- string(10) "4294967295"
93- }
75+ MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 4294967295
9476
9577Test { "longFieldName": { "$numberLong": "9223372036854775807" }}
96- [%s] PHONGO-BSON: WARNING > Integer overflow detected on your platform: 9223372036854775807
97- object(stdClass)#%d (%d) {
98- ["longFieldName"]=>
99- string(19) "9223372036854775807"
100- }
78+ MongoDB\Driver\Exception\InvalidArgumentException: Integer overflow detected on your platform: 9223372036854775807
10179
10280===DONE===
0 commit comments