Skip to content

Commit

Permalink
check for PHP version before checking for (get_magic_quotes_gpc()
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Nov 22, 2023
1 parent 7f383f7 commit e624483
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e624483

Please sign in to comment.