Skip to content

Commit ce6b11d

Browse files
authored
PHPC-1975: Disable SKIPIF caching for skip_if_not_clean on PHP 8.1 (#1261)
1 parent 0607b36 commit ce6b11d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/utils/skipif.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
require_once __DIR__ . '/basic.inc';
1111
require_once __DIR__ . '/tools.php';
1212

13+
/**
14+
* Disables SKIPIF caching (PHP 8.1+).
15+
*/
16+
function disable_skipif_caching()
17+
{
18+
if (PHP_VERSION_ID < 80100) {
19+
return;
20+
}
21+
22+
echo "nocache\n";
23+
}
24+
1325
/**
1426
* Skips the test if the topology is a sharded cluster.
1527
*/
@@ -404,6 +416,10 @@ function skip_if_not_clean($databaseName = DATABASE_NAME, $collectionName = COLL
404416
} catch (RuntimeException $e) {
405417
exit("skip Could not drop '$databaseName.$collectionName': " . $e->getMessage());
406418
}
419+
420+
/* Since this function modifies the state of the database, we need it to run
421+
* each time before a test. */
422+
disable_skipif_caching();
407423
}
408424

409425
function skip_if_no_getmore_failpoint()

0 commit comments

Comments
 (0)