2
2
PHPC-592: Property name corrupted when unserializing 64-bit integer on 32-bit platform
3
3
--SKIPIF--
4
4
<?php if (4 !== PHP_INT_SIZE ) { die ('skip Only for 32-bit platform ' ); } ?>
5
- --INI--
6
- mongodb.debug=stderr
7
5
--FILE--
8
6
<?php
9
7
@@ -24,15 +22,19 @@ $tests = [
24
22
25
23
foreach ($ tests as $ json ) {
26
24
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
+ }
28
31
echo "\n" ;
29
32
}
30
33
31
34
?>
32
35
===DONE===
33
36
<?php exit (0 ); ?>
34
37
--EXPECTF--
35
- %a
36
38
Test { "x": { "$numberLong": "-2147483648" }}
37
39
object(stdClass)#%d (%d) {
38
40
["x"]=>
@@ -46,25 +48,13 @@ object(stdClass)#%d (%d) {
46
48
}
47
49
48
50
Test { "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
54
52
55
53
Test { "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
61
55
62
56
Test { "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
68
58
69
59
Test { "longFieldName": { "$numberLong": "-2147483648" }}
70
60
object(stdClass)#%d (%d) {
@@ -79,24 +69,12 @@ object(stdClass)#%d (%d) {
79
69
}
80
70
81
71
Test { "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
87
73
88
74
Test { "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
94
76
95
77
Test { "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
101
79
102
80
===DONE===
0 commit comments