From 31e3145c56b4d8c3e251d7345758bfd9b2f02682 Mon Sep 17 00:00:00 2001 From: Tomas Pospisil <pospisil@praguebest.cz> Date: Mon, 3 Aug 2020 18:06:18 +0200 Subject: [PATCH] remove filter_inputs --- src/Tools/Dumper.php | 6 +++++- src/Tools/Settings/PersistentValue.php | 2 +- src/Tools/WebSwitcherUrls.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Tools/Dumper.php b/src/Tools/Dumper.php index f9a834a..551487f 100644 --- a/src/Tools/Dumper.php +++ b/src/Tools/Dumper.php @@ -120,7 +120,11 @@ final class Dumper public static function getDirectory(): string { if (self::$rootDir === null) { - $scriptPath = filter_input(INPUT_SERVER, 'SCRIPT_FILENAME'); + $scriptPath = $_SERVER['SCRIPT_FILENAME'] ?? null; + + if ($scriptPath === null) { + return ''; + } $dir = realpath(dirname($scriptPath)); while (false !== $dir && !is_dir($dir . '/vendor')) { diff --git a/src/Tools/Settings/PersistentValue.php b/src/Tools/Settings/PersistentValue.php index 24383e8..51e5e1a 100644 --- a/src/Tools/Settings/PersistentValue.php +++ b/src/Tools/Settings/PersistentValue.php @@ -25,7 +25,7 @@ final class PersistentValue session_start(); } - $get = filter_input(INPUT_POST, $settingCode, FILTER_SANITIZE_STRING); + $get = strip_tags($_POST[$settingCode]); $fromSession = $_SESSION[self::PREFIX . $settingCode] ?? null; if ($get === null && $fromSession === null) { diff --git a/src/Tools/WebSwitcherUrls.php b/src/Tools/WebSwitcherUrls.php index e1f8f5f..1cb19ba 100644 --- a/src/Tools/WebSwitcherUrls.php +++ b/src/Tools/WebSwitcherUrls.php @@ -63,7 +63,7 @@ final class WebSwitcherUrls private function currentUrl(): string { $protocol = 'http'; - if (filter_input(INPUT_SERVER, 'HTTPS')) { + if ($_SERVER['HTTPS'] ?? null) { $protocol .= 's'; } $httpHost = $_SERVER['HTTP_HOST'] ?? ''; -- GitLab