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 method availability before calling Log::flushSharedContext() #7

Closed
wants to merge 1 commit into from

Conversation

ajaxray
Copy link
Contributor

@ajaxray ajaxray commented Aug 13, 2024

There are some edge cases where $app['log'] may not contain flushSharedContext() method.
In the next statement, in the case of withoutContext(), 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

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

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

Copy link

Thank you for your pull request. However, you have submitted this PR on the Illuminate organization which is a read-only sub split of laravel/framework. Please submit your PR on the https://github.com/laravel/framework repository.

Thanks!

@github-actions github-actions bot closed this Aug 13, 2024
@ajaxray ajaxray changed the title Checking availability before calling Log::flushSharedContext() Checking method availability before calling Log::flushSharedContext() Aug 13, 2024
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.

1 participant