-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
"PHP Warning: Class __PHP_Incomplete_Class has no unserializer" when a class that was serialized with a custom handler no longer exists #18128
Comments
Cross link https://phabricator.wikimedia.org/T388725 |
We could remove the warning for just the incomplete class case: php-src/ext/standard/var_unserializer.re Lines 773 to 775 in 8622362
774c774,777
< zend_error(E_WARNING, "Class %s has no unserializer", ZSTR_VAL(ce->name));
---
> // Skip warning when the class was not found and __PHP_Incomplete_Class is used
> if (ce != PHP_IC_ENTRY) {
> zend_error(E_WARNING, "Class %s has no unserializer", ZSTR_VAL(ce->name));
> } but I'm not sure if this can target 8.3+ or master, does it count as a bug fix? The error is correct, its just unexpected |
Well, just suppressing the warning might not be a great idea. The data originally returned by
Optimally, we'd store it as a property. But then again, |
If you would like to see this fixed, I think this warrants a discussion on the mailing list. I don't think there's a convincing reason to fix this now, given |
That's fair. I think it's reasonable to leave this unchanged for compatibility reasons, and consider it a known issue with |
Thanks for your feedback. Let's close this then, as the issue will resolve in PHP 9.0. |
Description
A warning "PHP Warning: Class __PHP_Incomplete_Class has no unserializer" is emitted when a class that was serialized with a custom handler (
instanceof Serializable
/ 'C' format) no longer exists.This is unexpected to me, because the real problem is that the class does not exist at all, not that it has no unserializer. There's no warning for that though, the user is expected to check for instances of
__PHP_Incomplete_Class
.The following code:
Resulted in this output:
But I expected this output instead:
PHP Version
PHP 8.3.6
Operating System
No response
The text was updated successfully, but these errors were encountered: