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.4] Handle missing or malformed config/app.php file #18466

Merged
merged 2 commits into from
Mar 24, 2017
Merged

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

merged 2 commits into from
Mar 24, 2017

Conversation

themsaid
Copy link
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
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
Member

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