Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:5.3from
itsa-sh:5.3
Dec 14, 2016
Merged

[5.3] Fixed runtime error for when facade root not set.#16775
taylorotwell merged 1 commit into
laravel:5.3from
itsa-sh:5.3

Conversation

@itsa-sh

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

Copy link
Copy Markdown

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

taylorotwell commented Dec 13, 2016

Copy link
Copy Markdown
Member

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

@taylorotwell

Copy link
Copy Markdown
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

itsa-sh commented Dec 13, 2016

Copy link
Copy Markdown
Author

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.

2 participants