Make WordPress Core

Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#60326 closed defect (bug) (fixed)

Unset variable set by reference after a foreach loop

Reported by: get_dave's profile get_dave Owned by: youknowriad's profile youknowriad
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

Applies the changes from https://github.com/WordPress/gutenberg/pull/55261 which needed to be synced to Core.

In PHP it is a good practice to unset $value if it was created by reference in a foreach loop, as the reference is still valid outside the loop, and this avoids accidental bugs.

Change History (4)

This ticket was mentioned in PR #5934 on WordPress/wordpress-develop by @get_dave.


9 months ago
#1

  • Keywords has-patch added

Applies the changes from https://github.com/WordPress/gutenberg/pull/55261 which need to be synced to Core.

In PHP it is a good practice to unset $value if it was created by reference in a foreach loop, as the reference is still valid outside the loop, and this avoids accidental bugs.

Trac ticket: https://core.trac.wordpress.org/ticket/60326

#2 @youknowriad
9 months ago

  • Milestone changed from Awaiting Review to 6.5

#3 @youknowriad
9 months ago

  • Owner set to youknowriad
  • Resolution set to fixed
  • Status changed from new to closed

In 57340:

Editor: Unset reference used in foreach statement.

In PHP it is a good practice to unset $value if it was created by reference in a foreach loop, as the reference is still valid outside the loop, and this avoids accidental bugs.

Props get_dave.
Fixes #60326.

Note: See TracTickets for help on using tickets.