Skip to content

[VarExporter] PHP8.2 Deprecated dynamic properties created in LazyGhostTrait::__set() #48638

Answered by nicolas-grekas
emteknetnz asked this question in Q&A
Discussion options

You must be logged in to vote

The trait simulates what native PHP would do. Because you access the dynamic property, __set sets the property, and triggers the notice. This is the expected simulated behavior.

Then why are you trying to use it? What goal do you have?

LazyGhostTrait provides lazy-loading to a class. If you want this class to also have magic setters, the easiest way is to use inheritance, where the class that uses the trait extends the one with the magic methods.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by nicolas-grekas
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #48637 on December 14, 2022 08:28.