Make WordPress Core

Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#57972 closed defect (bug) (duplicate)

PHP Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /wp-includes/Requests/Utility/CaseInsensitiveDictionary.php

Reported by: codelyfe's profile codelyfe Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: External Libraries Keywords:
Focuses: Cc:

Description

Here is the fix:

public function getIterator(): iterable { // Add 'iterable' to the return type
    return new \ArrayIterator($this->data);
}
#[\ReturnTypeWillChange] // Add the #[\ReturnTypeWillChange] attribute before the method declaration

Change History (2)

#1 @costdev
21 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @codelyfe, welcome to Trac and thanks for opening this ticket!

This has been resolved as part of the upgrade of Requests (#54504) included in WordPress 6.2.

I'll close this ticket as a duplicate of #54504. Thanks a lot for this report! Hope you'll join in testing WordPress 6.2 RC3 and, after March 28th, WordPress 6.2!

#2 @SergeyBiryukov
21 months ago

  • Component changed from General to External Libraries
Note: See TracTickets for help on using tickets.