-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Add support for extending stdClass objects #54613
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
Comments
What about classes extending |
I am not 100 percent sure what you mean. A getter/setter does not change anything for unknown properties during serialize/unserialize. The only possible solution would be magic getters/setters to set the unknown property. |
And as described above the problem is in unserialize to. In this case the following lines: } elseif ($object instanceof \stdClass && property_exists($object, $property)) {
$object->$property = $value;
} elseif (!$this->ignoreInvalidProperty) { The property_exists might not be needed imho. "} elseif ($object instanceof \stdClass) {" works |
Thank you for this suggestion. |
Yes, we still need that Feature |
Someone will have to do the actual work. Feature requests don't resolve magically. |
@xabbuh
|
Please send a PR with the changes that you have in mind to move things forward. |
Thank you for this suggestion. |
Hello? This issue is about to be closed if nobody replies. |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
Symfony version(s) affected
Description
The serialize and unserialize for stdClass works because of this code in the class ObjectNormalizer + method extractAttributes
but this code does not check for classes, that are extending stdClass.
How to reproduce
Possible Solution
Better would be some additional code like this:
Additional Context
No response
The text was updated successfully, but these errors were encountered: