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

WordPress Trac noreply at wordpress.org
Tue Jan 23 17:09:38 UTC 2024


#60326: Unset variable set by reference after a foreach loop
--------------------------+--------------------------
 Reporter:  get_dave      |       Owner:  youknowriad
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  6.5
Component:  Editor        |     Version:
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+--------------------------
Changes (by youknowriad):

 * owner:  (none) => youknowriad
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"57340" 57340]:
 {{{
 #!CommitTicketReference repository="" revision="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.
 }}}

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


More information about the wp-trac mailing list