From e6244838b8b95539173f499755efacc8104f3291 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 22 Nov 2023 17:28:53 -0500 Subject: [PATCH] check for PHP version before checking for (get_magic_quotes_gpc() --- src/Request.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Request.php b/src/Request.php index c6a5265..fea5dbc 100644 --- a/src/Request.php +++ b/src/Request.php @@ -116,11 +116,12 @@ public static function getVar($name, $default = null, $hash = 'default', $type = $var = static::cleanVar($input[$name], $mask, $type); // Handle magic quotes compatibility - if (function_exists('get_magic_quotes_gpc') - && @get_magic_quotes_gpc() && ($var != $default) - && ('FILES' !== $hash) - ) { - $var = static::stripSlashesRecursive($var); + if (PHP_VERSION_ID < 50400) { + if (get_magic_quotes_gpc() && ($var != $default) + && ('FILES' !== $hash) + ) { + $var = static::stripSlashesRecursive($var); + } } } elseif (null !== $default) { // Clean the default value @@ -505,8 +506,10 @@ public static function get($hash = 'default', $mask = 0) } // Handle magic quotes compatibility - if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() && ('FILES' !== $hash)) { - $input = static::stripSlashesRecursive($input); + if (PHP_VERSION_ID < 50400) { + if (get_magic_quotes_gpc() && ('FILES' !== $hash)) { + $input = static::stripSlashesRecursive($input); + } } $result = static::cleanVars($input, $mask);