laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.44k stars 11k forks source link

Illuminate\Support\ServiceProvider::mergeConfigFrom() should validate $path #20480

Closed m-lotze closed 7 years ago

m-lotze commented 7 years ago

Description:

In Illuminate\Support\ServiceProvider the method mergeConfigFrom() simply requires the given $path. I think the framework should check before if the given path exists and is a valid file.

On one of my servers the PHP function realpath is not working as expected and therefore returns false instead of a valid path. I used the package https://github.com/HTMLMin/Laravel-HTMLMin there, and this package uses realpath() in its ServiceProvider. This results in a FatalErrorException:

production.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: 
Illuminate\Support\ServiceProvider::mergeConfigFrom(): Failed opening required ''

Obviously it is the responsibility of the package to provide a real path, but i think it may be a good idea to validate the $path in mergeConfigFrom before requiring it.

themsaid commented 7 years ago

For suggestions and feature requests please use the https://github.com/laravel/internals repo.