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

[8.x] Check for incomplete class to prevent unexpected error when class cannot be loaded #38379

Merged

Conversation

the-real-christoph
Copy link
Contributor

Since PHP 7.2 is_object returns true even when class could not be correctly instantiated.

Currently trying to retry jobs of unknown classes (e.g. the job was created by another system) is crashing with "method_exists(): The script tried to execute a method or access a property of an incomplete object."

The change is aiming to allow job retry functionality independent from availability of class in the current context.

@the-real-christoph the-real-christoph changed the title Check for incomplete class to prevent unexpected error when class canot be loaded Check for incomplete class to prevent unexpected error when class cannot be loaded Aug 13, 2021
@GrahamCampbell GrahamCampbell changed the title Check for incomplete class to prevent unexpected error when class cannot be loaded [8.x] Check for incomplete class to prevent unexpected error when class cannot be loaded Aug 13, 2021
@GrahamCampbell
Copy link
Member

Thanks for the PR. Can you add a test here please?

@taylorotwell
Copy link
Member

Curious why you wrapped the last two conditions in parens?

@the-real-christoph
Copy link
Contributor Author

Curious why you wrapped the last two conditions in parens?

Mainly readability, otherwise would look like "!$instance instanceof __PHP_Incomplete_Class"

Test will be added soon. @GrahamCampbell

@taylorotwell taylorotwell merged commit a668e6a into laravel:8.x Aug 14, 2021
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.

None yet

3 participants