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

"Closure object cannot have properties" at the Illuminate\Queue\Queue::shouldDispatchAfterCommit() #46355

Closed
jonasraoni opened this issue Mar 5, 2023 · 3 comments

Comments

@jonasraoni
Copy link

  • Laravel Version: 9.21.5
  • PHP Version: 8.0.27
  • Database Driver & Version: MySQL

Description:

Fatal error at the method Illuminate\Queue\Queue::shouldDispatchAfterCommit().

The line checks for an object and a property:

if (is_object($job) && isset($job->afterCommit)) {

Closures are expected (see below), but when a closure is passed, a fatal error is triggered:

* @param \Closure|string|object $job

Steps To Reproduce:

isset((fn () => 0)->property);
@driesvints
Copy link
Member

This seems to be fixed in PHP 8.1 but since we still support PHP 8.0 on Laravel v9 we should fix this there. We'd appreciate a PR.

@github-actions
Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@driesvints
Copy link
Member

This should be fixed by the above PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants