summaryrefslogtreecommitdiffstats
path: root/710.patch
blob: 2d3592d93aa819b829c420a2342c38983df9ba19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 97d14c110e91adc8387b7cb584b99c58ad23715d Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 13 Sep 2019 15:41:13 +0200
Subject: [PATCH] fix Trying to access array offset on value of type null

---
 src/Compiler.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Compiler.php b/src/Compiler.php
index d22d0a35..95131df9 100644
--- a/src/Compiler.php
+++ b/src/Compiler.php
@@ -2552,7 +2552,9 @@ protected function shouldEval($value)
      */
     protected function reduce($value, $inExp = false)
     {
-
+        if (is_null($value)) {
+            return null;
+        }
         switch ($value[0]) {
             case Type::T_EXPRESSION:
                 list(, $op, $left, $right, $inParens) = $value;
@@ -4373,7 +4375,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 +5891,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