File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
src/Illuminate/View/Compilers Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -417,7 +417,7 @@ protected function compileExtensions($value)
417
417
protected function compileStatements ($ value )
418
418
{
419
419
return preg_replace_callback (
420
- '/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?> \' (?: \\\\\' |[^ \' ])* \' ) | (?>"(?: \\\\ "|[^"])*") | (?>[^() \' " ]+) | (?3) )* \))?/x ' , function ($ match ) {
420
+ '/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?>[^() ]+) | (?3) )* \))?/x ' , function ($ match ) {
421
421
return $ this ->compileStatement ($ match );
422
422
}, $ value
423
423
);
Original file line number Diff line number Diff line change @@ -81,5 +81,14 @@ public function testLoopContentHolderIsExtractedFromForeachStatements()
81
81
$ string = '@foreach ($tasks as $task) ' ;
82
82
$ expected = '<?php $__currentLoopData = $tasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $task): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> ' ;
83
83
$ this ->assertEquals ($ expected , $ this ->compiler ->compileString ($ string ));
84
+
85
+ $ string = "@foreach(resolve('App \\\\DataProviders \\\\'. \$provider)->data() as \$key => \$value)
86
+ <input {{ \$foo ? 'bar': 'baz' }}>
87
+ @endforeach " ;
88
+ $ expected = "<?php \$__currentLoopData = resolve('App \\\\DataProviders \\\\'. \$provider)->data(); \$__env->addLoop( \$__currentLoopData); foreach( \$__currentLoopData as \$key => \$value): \$__env->incrementLoopIndices(); \$loop = \$__env->getLastLoop(); ?>
89
+ <input <?php echo e( \$foo ? 'bar': 'baz'); ?>>
90
+ <?php endforeach; \$__env->popLoop(); \$loop = \$__env->getLastLoop(); ?> " ;
91
+
92
+ $ this ->assertEquals ($ expected , $ this ->compiler ->compileString ($ string ));
84
93
}
85
94
}
Original file line number Diff line number Diff line change @@ -44,13 +44,15 @@ public function testVerbatimAndPhpStatementsDontGetMixedUp()
44
44
$ this ->assertEquals ($ expected , $ this ->compiler ->compileString ($ string ));
45
45
}
46
46
47
- public function testStringWithParenthesisDataValue ()
47
+ public function testStringWithParenthesisCannotBeCompiled ()
48
48
{
49
49
$ string = "@php( \$data = ['test' => ')']) " ;
50
50
51
51
$ expected = "<?php ( \$data = ['test' => ')']); ?> " ;
52
52
53
- $ this ->assertEquals ($ expected , $ this ->compiler ->compileString ($ string ));
53
+ $ actual = "<?php ( \$data = ['test' => '); ?>']) " ;
54
+
55
+ $ this ->assertEquals ($ actual , $ this ->compiler ->compileString ($ string ));
54
56
}
55
57
56
58
public function testStringWithEmptyStringDataValue ()
You can’t perform that action at this time.
0 commit comments