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.

git-svn-id: https://develop.svn.wordpress.org/trunk@57340 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella 2024-01-23 17:09:23 +00:00
parent 2f91b1f262
commit a21e447a14

View File

@ -1070,6 +1070,7 @@ class WP_Theme_JSON {
foreach ( $style_nodes as &$node ) {
$node['selector'] = static::scope_selector( $options['scope'], $node['selector'] );
}
unset( $node );
}
if ( ! empty( $options['root_selector'] ) ) {