You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an existing test ReflectionConstant_double_construct.phpt that ensures this isn't a problem for the ReflectionConstant class - maybe we should add one for each class?
There is an existing test ReflectionConstant_double_construct.phpt that ensures this isn't a problem for the ReflectionConstant class - maybe we should add one for each class?
Probably yes.
If you want to write the tests and give this a shot, go ahead :)
A related issue came up not that long ago (maybe @iluuu1994 remembers). We should consider to forbid calling constructors manually (and probably extend this to all magic methods). Any ->__*() is doing it wrong, in my opinion.
We should consider to forbid calling constructors manually (and probably extend this to all magic methods). Any ->__*() is doing it wrong, in my opinion.
I would go defensive, __construct, __destruct and __clone first. These are lifecycle methods with some expectations. Calling __isset manually is not harmful.
Activity
DanielEScherzer commentedon Oct 25, 2024
There is an existing test
ReflectionConstant_double_construct.phptthat ensures this isn't a problem for the ReflectionConstant class - maybe we should add one for each class?ndossche commentedon Oct 25, 2024
Probably yes.
If you want to write the tests and give this a shot, go ahead :)
cmb69 commentedon Oct 25, 2024
A related issue came up not that long ago (maybe @iluuu1994 remembers). We should consider to forbid calling constructors manually (and probably extend this to all magic methods). Any
->__*()is doing it wrong, in my opinion.DanielEScherzer commentedon Oct 25, 2024
I found this in a number of other classes in other extensions as well, should I file a dedicated task for each?
ndossche commentedon Oct 25, 2024
It doesn't matter too much how we keep track of it. Separate issue for reflection vs spl is perhaps a bit cleaner.
DanielEScherzer commentedon Oct 25, 2024
Okay, filed #16604
mvorisek commentedon Oct 25, 2024
I would go defensive,
__construct,__destructand__clonefirst. These are lifecycle methods with some expectations. Calling__issetmanually is not harmful.Fix phpGH-16601: Memory leak in Reflection constructors
Fix GH-16601: Memory leak in Reflection constructors
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3' into PHP-8.4
Merge branch 'PHP-8.4'