From 7ed2a79297207f447f9136071267ba5ce94a9461 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Mon, 13 Feb 2023 13:52:25 +0100 Subject: [PATCH] MDL-77097 store_mongodb: keep compatibility with PHP 7.4 Replaced 4 occurrences of get_debug_type() by gettype() to keep PHP 7.4 compatibility. Note this has not been applied to 4.2dev and up because, there, it's safe to use get_debug_type(). --- .../mongodb/MongoDB/Exception/InvalidArgumentException.php | 4 ++-- .../stores/mongodb/MongoDB/Exception/ResumeTokenException.php | 4 ++-- cache/stores/mongodb/readme_moodle.txt | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cache/stores/mongodb/MongoDB/Exception/InvalidArgumentException.php b/cache/stores/mongodb/MongoDB/Exception/InvalidArgumentException.php index 83271c180ed07..83b517b633ef1 100644 --- a/cache/stores/mongodb/MongoDB/Exception/InvalidArgumentException.php +++ b/cache/stores/mongodb/MongoDB/Exception/InvalidArgumentException.php @@ -20,7 +20,7 @@ use MongoDB\Driver\Exception\InvalidArgumentException as DriverInvalidArgumentException; use function array_pop; use function count; -use function get_debug_type; +use function gettype; use function implode; use function is_array; use function sprintf; @@ -56,6 +56,6 @@ public static function invalidType($name, $value, $expectedType) $expectedType = $typeString; } - return new static(sprintf('Expected %s to have type "%s" but found "%s"', $name, $expectedType, get_debug_type($value))); + return new static(sprintf('Expected %s to have type "%s" but found "%s"', $name, $expectedType, gettype($value))); } } diff --git a/cache/stores/mongodb/MongoDB/Exception/ResumeTokenException.php b/cache/stores/mongodb/MongoDB/Exception/ResumeTokenException.php index 362e72fa856f7..20036470c7ea8 100644 --- a/cache/stores/mongodb/MongoDB/Exception/ResumeTokenException.php +++ b/cache/stores/mongodb/MongoDB/Exception/ResumeTokenException.php @@ -17,7 +17,7 @@ namespace MongoDB\Exception; -use function get_debug_type; +use function gettype; use function sprintf; class ResumeTokenException extends RuntimeException @@ -30,7 +30,7 @@ class ResumeTokenException extends RuntimeException */ public static function invalidType($value) { - return new static(sprintf('Expected resume token to have type "array or object" but found "%s"', get_debug_type($value))); + return new static(sprintf('Expected resume token to have type "array or object" but found "%s"', gettype($value))); } /** diff --git a/cache/stores/mongodb/readme_moodle.txt b/cache/stores/mongodb/readme_moodle.txt index aa51dad8154a5..4072aef067d13 100644 --- a/cache/stores/mongodb/readme_moodle.txt +++ b/cache/stores/mongodb/readme_moodle.txt @@ -10,3 +10,7 @@ Import procedure: - Check the minim php driver version in https://docs.mongodb.com/drivers/php#compatibility and change the value in the "are_requirements_met" method if necessary. This version (1.8.0) requires PHP mongodb extension >= 1.8.0 + +Local changes: +- Replaced 4 occurrences of get_debug_type() by gettype() to keep PHP 7.4 compatibility. Note this + has not been applied to 4.2dev and up because, there, it's safe to use get_debug_type().