Using or generating the text url(), url(''), url("") any number of times inside a blade template will cause the Controller action method (that called the blade template) to be called a second time.
Log::debug('this happens twice'); return view('test.index');<div style="background-image: url('')"></div>I'm not sure what is going on, or why url('') is being parsed out as code somehow when it should be treated as HTML text. It's not inside {{}} and view source on the web browser shows it as intended. At the very least it should generate an error.
Hmmm, I can reproduce this. That's very odd indeed. Gonna mark this as a bug. Appreciating any help with investigating this.
This also happen when you use a function that ends with url() in a blade.
{{ $team->logo_url() }}
In this instance, however, it was calling the action method defined for the root url (e.g. Route::get('', RootController@index);)
I'm guessing this is caused a blade parsing pass looking for the url helper function.
https://laravel.com/docs/5.8/helpers#method-url
I'm concerned that there may be keywords other than 'url' that have this issue.
This is expected behavior. You're basically trying to use the current page as a background image. Your browser will load the page and attempt to use it as an image.
Basically, if you're on www.example.com and have a div with background-image: url(''), your browser will attempt to use www.example.com as the source for that image.
You can observe this in your browser's development tools, on the network tag. You can try it even here on github, inspect any element on the page and add a background-image: url('') rule to it, after having loaded the network tab. You will see an additional request being made to this current page, with "Cause" set to "img".
In your second example, is $team->logo_url() also empty, and being used as either an image source or a background-image source?
@36864 ah, very good thinking. That didn't occur to me.
Yes, you're correct.
I'm surprised that an empty src="" or url('') works that way.
Most helpful comment
This is expected behavior. You're basically trying to use the current page as a background image. Your browser will load the page and attempt to use it as an image.
Basically, if you're on
www.example.comand have a div withbackground-image: url(''), your browser will attempt to usewww.example.comas the source for that image.You can observe this in your browser's development tools, on the network tag. You can try it even here on github, inspect any element on the page and add a
background-image: url('')rule to it, after having loaded the network tab. You will see an additional request being made to this current page, with "Cause" set to "img".In your second example, is
$team->logo_url()also empty, and being used as either an image source or a background-image source?