Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is a fatal error caused by a missing use ArrayIterator;
statement in core/lib/Drupal/Core/Template/Attribute.php
Comments
Comment #1
psynaptic CreditAttribution: psynaptic commentedPatch attached.
Comment #2
andypostSo we need a test for this! Not sure it's critical
Comment #3
psynaptic CreditAttribution: psynaptic commentedComment #4
Fabianx CreditAttribution: Fabianx commentedFound as part of twig engine conversion.
I am not sure this really needs a test and how to test this. Any ideas?
I think it is bad practice to use a class inside of a namespace and not add a use statement.
So I'd rather say this is a regression of the Attribute patch as calling new Attribute() from a different namespace can error out with fatal error.
In this case a new Attribute() added to template_preprocess_table lead to fatal error of:
Comment #5
Fabianx CreditAttribution: Fabianx commentedUnassign again due to x-post.
Comment #6
Eric_A CreditAttribution: Eric_A commentedFound another one. Setting status to needs review for the bot.
Comment #7
Eric_A CreditAttribution: Eric_A commentedSo not one test in core actually uses these iterators?
Comment #8
BerdirAccording to the new guideline, global namespace objects should be referenced using \ArrayIterator, without explicit use statements.
Comment #10
rbayliss CreditAttribution: rbayliss commentedHere are two patches that provide a test and bring these two files up to standards in light of #8. The first one (test only) should fail, the second one should pass.
Comment #11
rbayliss CreditAttribution: rbayliss commentedWhoops. Set status.
Comment #12
tim.plunkettLooks good to me.
Comment #13
webchickAwesome, thanks for the fix and for the tests.
Committed and pushed to 8.x.