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

[L5.2] Wrong Auth Driver causes unexpected application end without errors #12821

Closed
iget-esoares opened this issue Mar 22, 2016 · 6 comments
Closed

Comments

@iget-esoares
Copy link
Contributor

Framework version: 5.2.24
PHP version: PHP 7.0.4-6+deb.sury.org~trusty+1

If a wrong (unexistent) auth driver is choose on config/auth.php setting, running anything that uses auth() facade will cause an unexpected end of execution.

Reproducing the bug

  1. Install a brand new Laravel 5.2.24
  2. Change the auth driver on config/auth.php to foobarbiz
  3. Run php artisan tinker
  4. Run auth()->attempt([])
  5. The tinker will close without errors. Also anything will close, not only on CLI.
@GrahamCampbell
Copy link
Member

Sounds like your php config is suppressing the fatal error.

@iget-esoares
Copy link
Contributor Author

@GrahamCampbell Looks like this isn't the problem:

esoares@esoares-desktop:~/Code/test$ php artisan tinker -vvv
Psy Shell v0.7.2 (PHP 7.0.4-6+deb.sury.org~trusty+1 — cli) by Justin Hileman
>>> error_reporting()
=> -1
>>> auth()->attempt([]);
esoares@esoares-desktop:~/Code/test$ 

@iget-esoares
Copy link
Contributor Author

The same occours using PHP5.6:

esoares@esoares-desktop:~/Code$ php5.6 artisan tinker
Psy Shell v0.7.2 (PHP 5.6.19-6+deb.sury.org~trusty+1 — cli) by Justin Hileman
>>> error_reporting()
=> -1
>>> auth()->attempt([]);
esoares@esoares-desktop:~/Code$

@iget-esoares
Copy link
Contributor Author

Tracking the issue, I found this piece of code:

vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php Method Resolve($name) at Line 89:

        if (isset($this->customCreators[$config['driver']])) {
            return $this->callCustomCreator($name, $config);
        } else {
            return $this->{'create'.ucfirst($config['driver']).'Driver'}($name, $config);
        }

The problem is happening here:

Since the driver name does not exists, it goes to the else, try to call $this->createWronDriverNameDriver($name, $config).

This call will be catch by the __call magic method, that will call $this->guard(), that will again call $this->resolve(), resulting in a infinite loop.

@iget-esoares
Copy link
Contributor Author

@GrahamCampbell I've made a Pull Request to solve this infinite loop bug. Please, take a look.

@GrahamCampbell
Copy link
Member

Thank you so much!

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

No branches or pull requests

2 participants