From a21e447a14157585f9018a4596c78739b3f3ad90 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 23 Jan 2024 17:09:23 +0000 Subject: [PATCH] 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 --- src/wp-includes/class-wp-theme-json.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 37f4d11ce9..4094e11524 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -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'] ) ) {