From e3fe3001c3274e1497bc82e77f14d50e40a8cea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 12 Jul 2020 10:33:58 +0300 Subject: [PATCH 1/4] Avoid calling get_magic_quotes_gpc() in tests for php >= 5.4 --- min_extras/tools/minifyUrl.php | 2 +- tests/HTTPConditionalGetTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/min_extras/tools/minifyUrl.php b/min_extras/tools/minifyUrl.php index 8851c87..8ae40bf 100644 --- a/min_extras/tools/minifyUrl.php +++ b/min_extras/tools/minifyUrl.php @@ -17,7 +17,7 @@ function getPost($key) if (! isset($_POST[$key])) { return null; } - return get_magic_quotes_gpc() + return (PHP_VERSION_ID < 50400 && get_magic_quotes_gpc()) ? stripslashes($_POST[$key]) : $_POST[$key]; } diff --git a/tests/HTTPConditionalGetTest.php b/tests/HTTPConditionalGetTest.php index e6365f4..19b19b5 100644 --- a/tests/HTTPConditionalGetTest.php +++ b/tests/HTTPConditionalGetTest.php @@ -127,7 +127,7 @@ class HTTPConditionalGetTest extends TestCase if (null === $inm) { unset($_SERVER['HTTP_IF_NONE_MATCH']); } else { - $_SERVER['HTTP_IF_NONE_MATCH'] = get_magic_quotes_gpc() + $_SERVER['HTTP_IF_NONE_MATCH'] = PHP_VERSION_ID < 50400 && get_magic_quotes_gpc() ? addslashes($inm) : $inm; } From b17c00c05cadaedea3481ffbda00e7c2f6695972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 12 Jul 2020 10:34:01 +0300 Subject: [PATCH 2/4] Make code symmetric: Check on ConditionalGet as well This partly reverts 5705fc9d899843fe8f6b6e0d361ccf01974b34a1 --- lib/HTTP/ConditionalGet.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/HTTP/ConditionalGet.php b/lib/HTTP/ConditionalGet.php index 8bfd0af..6087c04 100644 --- a/lib/HTTP/ConditionalGet.php +++ b/lib/HTTP/ConditionalGet.php @@ -317,7 +317,9 @@ class HTTP_ConditionalGet if (!isset($_SERVER['HTTP_IF_NONE_MATCH'])) { return false; } - $clientEtagList = $_SERVER['HTTP_IF_NONE_MATCH']; + $clientEtagList = PHP_VERSION_ID < 50400 && get_magic_quotes_gpc() + ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) + : $_SERVER['HTTP_IF_NONE_MATCH']; $clientEtags = explode(',', $clientEtagList); $compareTo = $this->normalizeEtag($this->_etag); From b89bc57164438a129e9db4f4bce09a53dbb6d1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 12 Jul 2020 11:50:37 +0300 Subject: [PATCH 3/4] Fix Array and string offset access syntax with curly braces is deprecated --- lib/Minify/ImportProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Minify/ImportProcessor.php b/lib/Minify/ImportProcessor.php index f8ed4b4..00e413b 100644 --- a/lib/Minify/ImportProcessor.php +++ b/lib/Minify/ImportProcessor.php @@ -182,7 +182,7 @@ class Minify_ImportProcessor private function truepath($path) { // whether $path is unix or not - $unipath = ('' === $path) || ($path{0} !== '/'); + $unipath = ('' === $path) || ($path[0] !== '/'); // attempts to detect if path is relative in which case, add cwd if (strpos($path, ':') === false && $unipath) { From e9d4db41ac86aa97893342a697aaa32e9cf1f8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 12 Jul 2020 10:34:09 +0300 Subject: [PATCH 4/4] Add php nightly test This adds php 8.0 to the test matrix --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 151cc42..eff1331 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ jobs: - php: "7.2" - php: "7.3" - php: "7.4" + - php: "nightly" - name: "Php CS Fixer" php: "7.3" env: