Skip to content

Commit 0f07beb

Browse files
committed
PHPC-1211: Update SKIPIFs for 32-bit platforms
1 parent 9f118a2 commit 0f07beb

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

scripts/convert-bson-corpus-tests.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
];
1616

1717
$for64bitOnly = [
18-
'Int64 type: MinValue' => "Can't represent 64-bit ints on a 32-bit platform",
19-
'Int64 type: MaxValue' => "Can't represent 64-bit ints on a 32-bit platform",
18+
/* Note: Although 64-bit integers be represented by the Int64 class, these
19+
* tests fail on 32-bit platforms due to json_canonicalize() roundtripping
20+
* values through PHP, which converts large integers to floats. */
21+
'Int64 type: MinValue' => "Can't represent 64-bit ints on a 32-bit platform",
22+
'Int64 type: MaxValue' => "Can't represent 64-bit ints on a 32-bit platform",
2023
];
2124

2225
$outputPath = realpath(__DIR__ . '/../tests') . '/bson-corpus/';

tests/cursor/bug1152-001.phpt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
--TEST--
22
PHPC-1152: Command cursors should use the same session for getMore and killCursors (implicit)
33
--SKIPIF--
4-
<?php if (PHP_INT_SIZE !== 8) { die("skip Can't represent 64-bit ints on a 32-bit platform"); } ?>
54
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
65
<?php skip_if_not_libmongoc_crypto(); ?>
76
<?php skip_if_not_live(); ?>
@@ -74,7 +73,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber
7473
}
7574

7675
if ($event->getCommandName() === 'getMore') {
77-
$cursorId = $event->getCommand()->getMore;
76+
$cursorId = (string) $event->getCommand()->getMore;
7877

7978
if ( ! isset($this->lsidByCursorId[$cursorId])) {
8079
throw new UnexpectedValueException('No previous command observed for cursor ID: ' . $cursorId);
@@ -84,7 +83,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber
8483
}
8584

8685
if ($event->getCommandName() === 'killCursors') {
87-
$cursorId = $event->getCommand()->cursors[0];
86+
$cursorId = (string) $event->getCommand()->cursors[0];
8887

8988
if ( ! isset($this->lsidByCursorId[$cursorId])) {
9089
throw new UnexpectedValueException('No previous command observed for cursor ID: ' . $cursorId);
@@ -99,7 +98,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber
9998
/* Associate the aggregate's session ID with its cursor ID so it can be
10099
* looked up by the subsequent getMore or killCursors */
101100
if ($event->getCommandName() === 'aggregate') {
102-
$cursorId = $event->getReply()->cursor->id;
101+
$cursorId = (string) $event->getReply()->cursor->id;
103102
$requestId = $event->getRequestId();
104103

105104
$this->lsidByCursorId[$cursorId] = $this->lsidByRequestId[$requestId];

tests/cursor/bug1152-002.phpt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
--TEST--
22
PHPC-1152: Command cursors should use the same session for getMore and killCursors (explicit)
33
--SKIPIF--
4-
<?php if (PHP_INT_SIZE !== 8) { die("skip Can't represent 64-bit ints on a 32-bit platform"); } ?>
54
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
65
<?php skip_if_not_libmongoc_crypto(); ?>
76
<?php skip_if_not_live(); ?>
@@ -72,7 +71,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber
7271
}
7372

7473
if ($event->getCommandName() === 'getMore') {
75-
$cursorId = $event->getCommand()->getMore;
74+
$cursorId = (string) $event->getCommand()->getMore;
7675

7776
if ( ! isset($this->lsidByCursorId[$cursorId])) {
7877
throw new UnexpectedValueException('No previous command observed for cursor ID: ' . $cursorId);
@@ -82,7 +81,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber
8281
}
8382

8483
if ($event->getCommandName() === 'killCursors') {
85-
$cursorId = $event->getCommand()->cursors[0];
84+
$cursorId = (string) $event->getCommand()->cursors[0];
8685

8786
if ( ! isset($this->lsidByCursorId[$cursorId])) {
8887
throw new UnexpectedValueException('No previous command observed for cursor ID: ' . $cursorId);
@@ -97,7 +96,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber
9796
/* Associate the aggregate's session ID with its cursor ID so it can be
9897
* looked up by the subsequent getMore or killCursors */
9998
if ($event->getCommandName() === 'aggregate') {
100-
$cursorId = $event->getReply()->cursor->id;
99+
$cursorId = (string) $event->getReply()->cursor->id;
101100
$requestId = $event->getRequestId();
102101

103102
$this->lsidByCursorId[$cursorId] = $this->lsidByRequestId[$requestId];

tests/cursor/cursor-destruct-001.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
--TEST--
22
MongoDB\Driver\Cursor destruct should kill a live cursor
33
--SKIPIF--
4-
<?php if (PHP_INT_SIZE !== 8) { die('skip Only for 64-bit platform'); } ?>
54
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
65
<?php skip_if_not_live(); ?>
76
<?php skip_if_not_clean(); ?>

tests/cursorid/cursorid-002.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
--TEST--
22
MongoDB\Driver\CursorID BSON serialization for killCursors command
33
--SKIPIF--
4-
<?php if (8 !== PHP_INT_SIZE) { die('skip Only for 64-bit platform'); } ?>
54
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
65
<?php skip_if_not_live(); ?>
76
<?php skip_if_not_clean(); ?>

tests/manager/bug1163-001.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
--TEST--
22
PHPC-1163: Unacknowledged write concern should omit implicit session
33
--SKIPIF--
4-
<?php if (PHP_INT_SIZE !== 8) { die("skip Can't represent 64-bit ints on a 32-bit platform"); } ?>
54
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
65
<?php skip_if_not_live(); ?>
76
<?php skip_if_server_version('<', '3.4'); ?>

0 commit comments

Comments
 (0)