Problem/Motivation

\Drupal\KernelTests\Core\Routing\RouteProviderTest::testDuplicateRoutePaths() can cause deprecations on PHP 8.1 due to using current() on $routes object which implements \IteratorAggregate

Steps to reproduce

Run core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php on PHP 8.1

  5x: current(): Calling current() on an object is deprecated
    5x in RouteProviderTest::testDuplicateRoutePaths from Drupal\KernelTests\Core\Routing

Proposed resolution

Use iterator's (getIterator()) methods

Remaining tasks

review, commit

User interface changes

no

API changes

no

Data model changes

no

Release notes snippet

no

CommentFileSizeAuthor
#2 3240194-2.patch878 bytesandypost
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

daffie’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

  • catch committed b9944c2 on 9.3.x
    Issue #3240194 by andypost: \Drupal\KernelTests\Core\Routing\...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed b9944c2 and pushed to 9.3.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.