Skip to content

[5.4] Handle missing or malformed config/app.php file - #18466

Merged
taylorotwell merged 2 commits into
laravel:5.4from
themsaid:handleNonFunctionalAppConfig
Mar 24, 2017
Merged

[5.4] Handle missing or malformed config/app.php file#18466
taylorotwell merged 2 commits into
laravel:5.4from
themsaid:handleNonFunctionalAppConfig

Conversation

@themsaid

Copy link
Copy Markdown
Member

In case the config/app.php file was missing or corrupted you get a PHP Fatal error: Maximum function nesting level of 'x' reached, this is because LogServiceProvider::configureHandler() will call itself recursively since it has $this->{'configure'.ucfirst($this->handler()).'Handler'}($log);

In case the app.php file couldn't be loaded $this->handler() will return null, causing the method to call itself.

In this PR I'm throwing an exception in case the app.php configuration file wasn't found, and if it was found but malformed I made sure Laravel can boot without it and be able to render the exception & log it.

$files = $this->getConfigurationFiles($app);

if (! isset($files['app'])) {
throw new \Exception('Unable not load the config/app.php file.');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick. This message should be "Unable to load the config/app.php file."

$files = $this->getConfigurationFiles($app);

if (! isset($files['app'])) {
throw new \Exception('Unable to load the config/app.php file.');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally, we import things. :)

@taylorotwell
taylorotwell merged commit aae7a9e into laravel:5.4 Mar 24, 2017
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.

4 participants