[wp-trac] [WordPress Trac] #54558: Notice: Undefined index in WordPress 5.9 Beta

WordPress Trac noreply at wordpress.org
Sat Dec 4 12:50:56 UTC 2021


#54558: Notice: Undefined index in WordPress 5.9 Beta
---------------------------------------------+-----------------------
 Reporter:  kafleg                           |       Owner:  audrasjb
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  5.9
Component:  Editor                           |     Version:  trunk
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------

Comment (by TobiasBg):

 [52312] added a foreach loop with the value being assigned by reference.
 This can lead to weird issues later on, if the variable (here: `$path`) is
 used again in the function, while the reference was not broken. While it's
 not in this case, let's follow best practices and add `unset( $path );`
 after the loop.

 See e.g. the example at https://www.php.net/manual/en/control-
 structures.foreach.php

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


More information about the wp-trac mailing list