From 771853f1bc634c45a3d0c5966b940422f0ff2be3 Mon Sep 17 00:00:00 2001 From: Artem Goutsoul Date: Tue, 7 Jul 2020 09:50:03 +0300 Subject: [PATCH 1/3] php 7.4 fixes --- src/Compiler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler.php b/src/Compiler.php index d22d0a35..5a45eeaf 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -2552,8 +2552,8 @@ protected function shouldEval($value) */ protected function reduce($value, $inExp = false) { - - switch ($value[0]) { + $switch = !empty($value) ? $value[0] : null; + switch ($switch) { case Type::T_EXPRESSION: list(, $op, $left, $right, $inParens) = $value; From 6b290be40f35abf58bd447340b271a050f0129f5 Mon Sep 17 00:00:00 2001 From: Artem Goutsoul Date: Tue, 7 Jul 2020 09:54:16 +0300 Subject: [PATCH 2/3] php 7.4 fixes --- src/Compiler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler.php b/src/Compiler.php index 5a45eeaf..2fefccc1 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -4373,7 +4373,7 @@ protected function sortArgs($prototype, $args) foreach ($args as $arg) { list($key, $value) = $arg; - $key = $key[1]; + $key = isset($key[1]) ? $key[1] : ''; if (empty($key)) { $posArgs[] = empty($arg[2]) ? $value : $arg; @@ -5889,7 +5889,7 @@ protected function libStrSlice($args) $start--; } - $end = (int) $args[2][1]; + $end = (isset($args[2][1]) ? (int) $args[2][1] : 0); $length = $end < 0 ? $end + 1 : ($end > 0 ? $end - $start : $end); $string[2] = $length From bbf71f606523ab318c031dbf5731b3d518e877e3 Mon Sep 17 00:00:00 2001 From: Artem Goutsoul Date: Tue, 21 Mar 2023 22:42:55 +0200 Subject: [PATCH 3/3] Update composer.json permit to be installed under php 8 (might not work) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index eaa8e87b..3fbc7cec 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "psr-4": { "Leafo\\ScssPhp\\Test\\": "tests/" } }, "require": { - "php": "^5.4.0 || ^7" + "php": "^5.4.0 || ^7 || ^8.0" }, "require-dev": { "squizlabs/php_codesniffer": "~2.5",