1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 23:55:26 +02:00

[ticket/15742] Remove get_magic_quotes_gpc() call

PHPBB3-15742
This commit is contained in:
Jakub Senko 2018-09-06 14:15:08 +02:00
parent bd90a53589
commit 8eb48e2812
No known key found for this signature in database
GPG Key ID: 6A7C328CD66EC21E
3 changed files with 0 additions and 46 deletions

View File

@ -150,8 +150,6 @@ class request implements \phpbb\request\request_interface
return; return;
} }
$this->type_cast_helper->add_magic_quotes($value);
// setting to null means unsetting // setting to null means unsetting
if ($value === null) if ($value === null)
{ {

View File

@ -18,28 +18,6 @@ namespace phpbb\request;
*/ */
class type_cast_helper implements \phpbb\request\type_cast_helper_interface class type_cast_helper implements \phpbb\request\type_cast_helper_interface
{ {
/**
* @var string Whether slashes need to be stripped from input
*/
protected $strip;
/**
* Initialises the type cast helper class.
* All it does is find out whether magic quotes are turned on.
*/
public function __construct()
{
if (version_compare(PHP_VERSION, '5.4.0-dev', '>='))
{
$this->strip = false;
}
else
{
$this->strip = (@get_magic_quotes_gpc()) ? true : false;
}
}
/** /**
* Recursively applies addslashes to a variable. * Recursively applies addslashes to a variable.
* *
@ -68,19 +46,6 @@ class type_cast_helper implements \phpbb\request\type_cast_helper_interface
} }
} }
/**
* Recursively applies addslashes to a variable if magic quotes are turned on.
*
* @param mixed &$var Variable passed by reference to which slashes will be added.
*/
public function add_magic_quotes(&$var)
{
if ($this->strip)
{
$this->addslashes_recursively($var);
}
}
/** /**
* Set variable $result to a particular type. * Set variable $result to a particular type.
* *
@ -129,8 +94,6 @@ class type_cast_helper implements \phpbb\request\type_cast_helper_interface
$result = preg_replace('/[\x80-\xFF]/', '?', $result); $result = preg_replace('/[\x80-\xFF]/', '?', $result);
} }
} }
$result = ($this->strip) ? stripslashes($result) : $result;
} }
} }

View File

@ -25,13 +25,6 @@ interface type_cast_helper_interface
*/ */
public function addslashes_recursively(&$var); public function addslashes_recursively(&$var);
/**
* Recursively applies addslashes to a variable if magic quotes are turned on.
*
* @param mixed &$var Variable passed by reference to which slashes will be added.
*/
public function add_magic_quotes(&$var);
/** /**
* Set variable $result to a particular type. * Set variable $result to a particular type.
* *