bug: #3622983: PHP 8.5: Using an object for ArrayIterator is deprecated

AnnotationObject::getIterator() passes $this to \ArrayIterator, which is deprecated as of PHP 8.5.

The fix reads the properties with get_object_vars() from a closure bound to no class scope. The iterator still contains only the public (and dynamic) properties, in the same order, as before. Across the 35 plugin definitions of a site, the rebuilt definitions are identical with and without the change.

The workaround in #2 (get_object_vars($this)) is not equivalent: called inside the class it also returns protected and private properties (class, provider, _deprecated, _deprecatedProperties, …), and doMerge() then copies them between definitions.

AnnotationObjectTest covers both points: the iterator yields exactly the public properties (fails with the #2 workaround), and iterating triggers no deprecation (fails on the current code).

Closes #3622983

Merge request reports

Loading
Loading