[wp-trac] [WordPress Trac] #60326: Unset variable set by reference after a foreach loop

WordPress Trac noreply at wordpress.org
Tue Jan 23 14:39:37 UTC 2024


#60326: Unset variable set by reference after a foreach loop
--------------------------+-----------------------------
 Reporter:  get_dave      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60326>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list