Skip to content

Commit a0c1b53

Browse files
committed
Fix test due to quirck in PHP parser
1 parent 4a178a3 commit a0c1b53

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/bson/bson-timestamp_error-003.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@ echo throws(function() {
1010
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
1111

1212
echo throws(function() {
13-
new MongoDB\BSON\Timestamp(-2147483648, 0);
13+
/* I realise that "-2147483647 - 1" could be written as "-2147483648", *however*, PHP considers
14+
* the latter a floating point number, as it parses "-" and "2147483648" separately, and
15+
* "2147483648" doesn't fit in the 32-bit signed range. */
16+
new MongoDB\BSON\Timestamp(-2147483647 - 1, 0);
1417
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
1518

1619
echo throws(function() {
1720
new MongoDB\BSON\Timestamp(0, -1);
1821
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
1922

2023
echo throws(function() {
21-
new MongoDB\BSON\Timestamp(0, -2147483648);
24+
new MongoDB\BSON\Timestamp(0, -2147483647 - 1);
2225
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
2326

2427
?>

0 commit comments

Comments
 (0)