From f0cf6fa6efb1a39bc776c50f2334c8dc1ed1367f Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Mon, 24 Oct 2016 21:18:15 +0300 Subject: [PATCH] Update @foreach and @forelse regex to fix #16085 and similar cases (#16087) --- src/Illuminate/View/Compilers/BladeCompiler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/View/Compilers/BladeCompiler.php b/src/Illuminate/View/Compilers/BladeCompiler.php index 575d3950df04..d6e55ef4d965 100644 --- a/src/Illuminate/View/Compilers/BladeCompiler.php +++ b/src/Illuminate/View/Compilers/BladeCompiler.php @@ -579,7 +579,7 @@ protected function compileFor($expression) */ protected function compileForeach($expression) { - preg_match('/\( *(.*) +as *([^\)]*)/is', $expression, $matches); + preg_match('/\( *(.*) +as *(.*)\)$/is', $expression, $matches); $iteratee = trim($matches[1]); @@ -624,7 +624,7 @@ protected function compileForelse($expression) { $empty = '$__empty_'.++$this->forelseCounter; - preg_match('/\( *(.*) +as *([^\)]*)/is', $expression, $matches); + preg_match('/\( *(.*) +as *(.*)\)$/is', $expression, $matches); $iteratee = trim($matches[1]);