[5.7] The url helper generates the wrong url, when used in a queue. #805
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the url helper or generator is used in a command line based request, it will return the wrong url. This problem occured in Laravel a while ago. Someone fixed this problem and the fix was also implemented in Lumen. ( laravel/framework#14139)
The fix was implemented in the
kernel.php
in theConsole
directory. The fix currently is implemented like this:The
setRequestForConsole
, however, will never be called because the request is bound on every request. Console or not. The request alias is registered in theregisterContainerAliases
method in theApplication
. This method is called in thebootstrapContainer
method which is called in the constructor ofApplication
class. And theApplication
class will always be instantiated.That's why i replaced the conditional with a conditional which checks whether the request runs in the console. That way we can determine whether or not to use the
setRequestForConsole
method.#791
#768