in my template i use
@section('title', 'Hello :)')
which results in error:
Parse error: syntax error, unexpected '?'
imo that's a no-fix, I suggest that you use the other format:
@section('title')
hello :)
@stop
Should be fixed or at least documented for the time being
@themsaid
imo that's a no-fix
No fix? The docs for 5.4 show that it's possible to do that, and it has been in previous versions, seems to me it's a bug. https://laravel.com/docs/5.4/blade
I'm not saying it's not a bug, I just don't think there's an easy way to fix it.
Oh my bad, I interpreted it as "we have no intentions of fixing this."
I had a crack at trying to solve this - but my RegEx skills are not the greatest.
The problem is this line here from Illuminate\View\Compiliers\BladeCompiler:
protected function compileStatements($value)
{
return preg_replace_callback(
'/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x', function ($match) {
return $this->compileStatement($match);
}, $value
);
}
We need to be able to modify that RegEx to ignore parenthesis inside quotes (both " and ').
I posted a question on StackOverflow about it here: http://stackoverflow.com/q/43970168/1317935 - I got one answer, but even that doesnt fully solve it, and it creates other situations where the whole thing might fail.
For example - imagine this string:
@section('title', 'Hello") there')
That's going to be very difficult via RegEx.. I think @themsaid is right - that it'll probably have to be a limitation of Blade for this edge case.
Closing as a no-fix, blade has some limitations and that's one of them.
Most helpful comment
Should be fixed or at least documented for the time being