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.3] Fixed runtime error for when facade root not set. #16775

Merged
merged 1 commit into from
Dec 14, 2016
Merged

[5.3] Fixed runtime error for when facade root not set. #16775

merged 1 commit into from
Dec 14, 2016

Conversation

itsa-sh
Copy link

@itsa-sh itsa-sh commented Dec 13, 2016

I've stumbled upon the following error:

RuntimeException in Facade.php line 234:

A facade root has not been set.

Comparing the RouteServiceProvider to previous versions, only in 5.3 I have noticed the facade being used.

I personally don't like facades and thankfully Laravel has never forced me to use them, until this which is a minor tweak :)

@taylorotwell
Copy link
Member

taylorotwell commented Dec 13, 2016

How did you trigger this error? How do you recreate it from a fresh Laravel instance?

@taylorotwell
Copy link
Member

Also that $this->app['router'] call is exactly the same call a facade would make, so you might want to reconsider your dislike of them. :P

@itsa-sh
Copy link
Author

itsa-sh commented Dec 13, 2016

When I say I dislike facades I meant the way in which a static call to a Facade is made such as Route::get over $this->app['router'] or app('router'). I understand it's a case of personal preference, but I believe the facade can be harder to read but I admit that's pedantic.

There are two things I did actually, first was to remove the 'aliases' array from config/app.php in order to prevent the use of these Facades (I believe < 5.3 it used to error when this was not an array, whereas now it doesn't - so I really love that).

The second thing (whilst I was dabbling) was inside App\Http\Kernel which extends the core, I simply set $bootstrappers from the parent to the same values except this one: 'Illuminate\Foundation\Bootstrap\RegisterFacades' which was omitted and the result of the exception above.

@GrahamCampbell GrahamCampbell changed the title Fixed runtime error for when facade root not set. [5.3] Fixed runtime error for when facade root not set. Dec 13, 2016
@taylorotwell taylorotwell merged commit c79269b into laravel:5.3 Dec 14, 2016
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.

None yet

2 participants