From 823adb78ef0f2739b0c002c201b72682c72f02b6 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 5 Mar 2017 11:22:24 +0100 Subject: [PATCH] bumping required PHP to 5.4, removing unneccessary code, resolves #186 --- CHANGELOG.md | 1 + lib/Filter.php | 15 --------------- lib/PrivateBin.php | 4 ++-- lib/Request.php | 7 ------- tst/FilterTest.php | 8 -------- 5 files changed, 3 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b10a3a39..10fab74d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * **next (not yet released)** * ADDED: Translations for Spanish, Occitan, Norwegian and Portuguese * ADDED: Option in configuration to change the default "PrivateBin" title of the site + * CHANGED: Minimum required PHP version is 5.4 (#186) * CHANGED: Cleanup of bootstrap template variants and moved icons to `img` directory * **1.1 (2016-12-26)** * ADDED: Translations for Italian and Russian diff --git a/lib/Filter.php b/lib/Filter.php index 60f6f170..951e2651 100644 --- a/lib/Filter.php +++ b/lib/Filter.php @@ -21,21 +21,6 @@ use Exception; */ class Filter { - /** - * strips slashes deeply - * - * @access public - * @static - * @param mixed $value - * @return mixed - */ - public static function stripslashesDeep($value) - { - return is_array($value) ? - array_map('self::stripslashesDeep', $value) : - stripslashes($value); - } - /** * format a given time string into a human readable label (localized) * diff --git a/lib/PrivateBin.php b/lib/PrivateBin.php index fc69e57c..fb3e523f 100644 --- a/lib/PrivateBin.php +++ b/lib/PrivateBin.php @@ -120,8 +120,8 @@ class PrivateBin */ public function __construct() { - if (version_compare(PHP_VERSION, '5.3.0') < 0) { - throw new Exception(I18n::_('%s requires php 5.3.0 or above to work. Sorry.', I18n::_('PrivateBin')), 1); + if (version_compare(PHP_VERSION, '5.4.0') < 0) { + throw new Exception(I18n::_('%s requires php 5.4.0 or above to work. Sorry.', I18n::_('PrivateBin')), 1); } if (strlen(PATH) < 0 && substr(PATH, -1) !== DIRECTORY_SEPARATOR) { throw new Exception(I18n::_('%s requires the PATH to end in a "%s". Please update the PATH in your index.php.', I18n::_('PrivateBin'), DIRECTORY_SEPARATOR), 5); diff --git a/lib/Request.php b/lib/Request.php index d3c36d38..e6c1c749 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -80,13 +80,6 @@ class Request */ public function __construct() { - // in case stupid admin has left magic_quotes enabled in php.ini (for PHP < 5.4) - if (version_compare(PHP_VERSION, '5.4.0') < 0 && get_magic_quotes_gpc()) { - $_POST = array_map('PrivateBin\\Filter::stripslashesDeep', $_POST); - $_GET = array_map('PrivateBin\\Filter::stripslashesDeep', $_GET); - $_COOKIE = array_map('PrivateBin\\Filter::stripslashesDeep', $_COOKIE); - } - // decide if we are in JSON API or HTML context $this->_isJsonApi = $this->_detectJsonRequest(); diff --git a/tst/FilterTest.php b/tst/FilterTest.php index 63cc8f89..96097a02 100644 --- a/tst/FilterTest.php +++ b/tst/FilterTest.php @@ -4,14 +4,6 @@ use PrivateBin\Filter; class FilterTest extends PHPUnit_Framework_TestCase { - public function testFilterStripsSlashesDeeply() - { - $this->assertEquals( - array("f'oo", "b'ar", array("fo'o", "b'ar")), - Filter::stripslashesDeep(array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar"))) - ); - } - public function testFilterMakesTimesHumanlyReadable() { $this->assertEquals('5 minutes', Filter::formatHumanReadableTime('5min'));