Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.7] The url helper generates the wrong url, when used in a queue. #805

Merged
merged 1 commit into from
Sep 13, 2018
Merged

Conversation

jensdenies
Copy link
Contributor

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 the Console directory. The fix currently is implemented like this:

if (! $this->app->bound('request')) {
    $this->setRequestForConsole($this->app);
}

The setRequestForConsole, however, will never be called because the request is bound on every request. Console or not. The request alias is registered in the registerContainerAliases method in the Application. This method is called in the bootstrapContainer method which is called in the constructor of Application class. And the Application 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants