From 5237a75ec90da0b4d8d2c195eeccc5643e45b06f Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Tue, 21 Sep 2021 14:12:59 -0400 Subject: [PATCH] PHPC-1975: Disable SKIPIF caching for skip_if_not_clean on PHP 8.1 --- tests/utils/skipif.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/utils/skipif.php b/tests/utils/skipif.php index 9b9a4cd58..6e440b9e2 100644 --- a/tests/utils/skipif.php +++ b/tests/utils/skipif.php @@ -10,6 +10,18 @@ require_once __DIR__ . '/basic.inc'; require_once __DIR__ . '/tools.php'; +/** + * Disables SKIPIF caching (PHP 8.1+). + */ +function disable_skipif_caching() +{ + if (PHP_VERSION_ID < 80100) { + return; + } + + echo "nocache\n"; +} + /** * Skips the test if the topology is a sharded cluster. */ @@ -404,6 +416,10 @@ function skip_if_not_clean($databaseName = DATABASE_NAME, $collectionName = COLL } catch (RuntimeException $e) { exit("skip Could not drop '$databaseName.$collectionName': " . $e->getMessage()); } + + /* Since this function modifies the state of the database, we need it to run + * each time before a test. */ + disable_skipif_caching(); } function skip_if_no_getmore_failpoint()