[wp-trac] [WordPress Trac] #54558: Notice: Undefined index in WordPress 5.9 Beta
WordPress Trac
noreply at wordpress.org
Sat Dec 4 17:19:02 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 SergeyBiryukov):
In [changeset:"52322" 52322]:
{{{
#!CommitTicketReference repository="" revision="52322"
Coding Standards: Break the `$path` reference after a `foreach` loop in
`block_editor_rest_api_preload()`.
When using a `foreach` loop with a value assigned by reference, the
variable continues to point to the last array element even after the loop,
so it is recommended to destroy it by `unset()` to avoid unexpected
behavior later on.
See [https://www.php.net/manual/en/control-structures.foreach.php PHP
Manual: foreach].
Follow-up to [52312], [52313].
Props TobiasBg.
See #54558.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54558#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list