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

Check that the app logger has a driver() function, preventing fatal errors #49635

Conversation

lvaneijden
Copy link

It appears that when the application logger is used and workers with a Redis connection are registered, it is assumed that the existing logger implements a 'driver' function, which then gets called for another method. Whenever a logger instance is attached that does not have the 'driver' function, the code breaks with a fatal error:
In QueueServiceProvider.php line 201:

Call to undefined method Monolog\Logger::driver()

Unsure of what the $resetScope callback is actually used for, I found that adding an additional check to see if the 'driver' function exists is small enough of a change that creating a new unit tests would be overkill. This pull request also does not break any currently running tests.

Fixes:
In QueueServiceProvider.php line 201:

Call to undefined method Monolog\Logger::driver()
@taylorotwell
Copy link
Member

The log binding in the container is a LogManager instance, which does have a driver method.

CleanShot 2024-01-10 at 08 45 53@2x

@lvaneijden
Copy link
Author

But aren't applications able of overwriting this logger in some way? I'll have a look what my application has for sort of class bound to the 'log' register...but I don't see why we should not add this small patch in

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