-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarExporter] add #[Ignore]
to proxy-related methods to prevent them from being serialized
#54224
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
Conversation
I would prefer dealing with this on the Serialize side. Is that doable without too much impact? |
It should be possible, but I don't know if there is any impact yet. I considered that approach, but the consumer should not need to be aware it is dealing with a proxy object. However, either way it is going to be ugly. It is either Serializer needs to know it is dealing with a proxy or the proxy needs to tell Serializer to skip certain properties. Then, there are third party serializers and proxy generators. To me, the best way forward is to change $object->isLazyObjectInitialized(); we do this: $object::isLazyObjectInitialized($object); Alternatively, it should offer the option not to expose WDYT? |
Yes I agree, it'd be better to move all methods of LazyObjectInterface outside of it. We'd need a BC-path forward though. |
Why adding the attribute on e.g. lazyObjectState while only isLazyObjectInitialized leaks? |
I added them for completeness, because some serializers access private properties directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big fan of the concern leaking here but still pragmatic. The plan might be to remove this API in favor of a static one so fine by that plan also.
…m from being serialized
be22a32
to
7c2e848
Compare
Thank you @priyadi. |
Adds
#[Ignore]
to proxy-related methods so they are not included in serialization.Previously, serializing a lazy object will result in something like this: