Skip to content

Commit

Permalink
MDL-77097 store_mongodb: keep compatibility with PHP 7.4
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
stronk7 committed Feb 24, 2023
1 parent 6573196 commit 7ed2a79
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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)));
}
}
Expand Up @@ -17,7 +17,7 @@

namespace MongoDB\Exception;

use function get_debug_type;
use function gettype;
use function sprintf;

class ResumeTokenException extends RuntimeException
Expand All @@ -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)));
}

/**
Expand Down
4 changes: 4 additions & 0 deletions cache/stores/mongodb/readme_moodle.txt
Expand Up @@ -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().

0 comments on commit 7ed2a79

Please sign in to comment.