-
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 8.2 readonly
classes can have dynamic properties created by unserialize()
#9325
Comments
Related to #9186. |
@nikic @kocsismate fyi Checks would probably be similar to those found in zend_object_handlers We may want a different error message for private/protected properties with embedded null bytes (if they were declared when serializing but not declared when unserializing), e.g.
if (UNEXPECTED(zobj->ce->ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES)) {
zend_forbidden_dynamic_property(zobj->ce, name);
variable_ptr = &EG(error_zval);
goto exit;
}
if (UNEXPECTED(!(zobj->ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES))) {
if (UNEXPECTED(!zend_deprecated_dynamic_property(zobj, name))) {
variable_ptr = &EG(error_zval);
goto exit;
}
} |
To avoid Looking at ext/standard/basic_functions.stub.php - |
Why are you pinging nikic in your PRs? Didn't he switch focus from PHP to LLMV? |
I created #9354 for fixing the original, more general bug (#9186) as well as the dynamic property deprecation @TysonAndre mentioned here. |
Fixed via adb45a6 |
Description
The following code:
Resulted in this output:
But I expected this output instead:
Cannot create dynamic property
errors should probably be thrown in unserialize() to avoid creatingreadonly
class instances with dynamic properties#[AllowDynamicProperties]
attributes, because in php 9.0, unserialize() on the same data would become a dataPHP Version
PHP 8.2.0beta2
Operating System
No response
The text was updated successfully, but these errors were encountered: