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

Checking availability before calling Log::flushSharedContext() method #52470

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

ajaxray
Copy link
Contributor

@ajaxray ajaxray commented Aug 13, 2024

Type: minor bug fix
Location: Illuminate\Queue\QueueServiceProvider::registerWorker()

There are some edge cases where $app['log'] may not contain flushSharedContext() method.

In the next statement, in the case of withoutContext() (line 204 of QueueServiceProvider), it's checking for method existence. Similarly, I think i'd be nice to check method existence before calling this function too.

Background

I was trying to use Queue in a Laravel Zero app without installing log component. And was getting this error:

Call to undefined method Psr\Log\NullLogger::flushSharedContext()
at vendor/illuminate/queue/QueueServiceProvider.php:201

Then I checked and found that, the Psr\Log\NullLogger actually don't have this method.

CleanShot 2024-08-13 at 19 39 52@2x

@taylorotwell taylorotwell merged commit b8ca298 into laravel:11.x Aug 13, 2024
31 checks passed
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