From 6d28b0b28d941ac766092b13f65e56d63b782154 Mon Sep 17 00:00:00 2001 From: Joyce Babu Date: Sun, 17 Nov 2019 23:18:01 +0530 Subject: [PATCH 1/2] Prevent array access on null value Fix 'Trying to access array offset on value of type null' notice on PHP 7.4 --- src/Mustache/Parser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mustache/Parser.php b/src/Mustache/Parser.php index c36a84a..0ec4192 100644 --- a/src/Mustache/Parser.php +++ b/src/Mustache/Parser.php @@ -149,7 +149,7 @@ class Mustache_Parser case Mustache_Tokenizer::T_BLOCK_VAR: if ($this->pragmaBlocks) { // BLOCKS pragma is enabled, let's do this! - if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { + if (isset($parent) && $parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { $token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_BLOCK_ARG; } $this->clearStandaloneLines($nodes, $tokens); @@ -275,7 +275,7 @@ class Mustache_Parser */ private function checkIfTokenIsAllowedInParent($parent, array $token) { - if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { + if (isset($parent) && $parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) { throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token); } } From a04f70e8b5b4eb76bd7e74bf65dee7e91550ae30 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 23 Nov 2019 10:51:33 -0800 Subject: [PATCH 2/2] Let 7.4 snapshot fail for now --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 14ef706..d88c6f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ matrix: dist: trusty allow_failures: - php: hhvm + - php: 7.4snapshot script: - '[[ "$TRAVIS_PHP_VERSION" = 5.2* ]] && phpunit || vendor/bin/phpunit --verbose'