Skip to content

Commit

Permalink
Editor: Use static closures to avoid memory leaks.
Browse files Browse the repository at this point in the history
Backports Gutenberg changes from WordPress/gutenberg#50723.

Amends [55822].

Fixes #58323.
Props westonruter, spacedmonkey, flixos90. 


git-svn-id: https://develop.svn.wordpress.org/trunk@56038 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
westonruter committed Jun 26, 2023
1 parent b6fde03 commit c7597fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,7 @@ static function( $split_feature_selector ) use ( $clean_style_variation_selector
$pseudo_matches = array_values(
array_filter(
$element_pseudo_allowed,
function( $pseudo_selector ) use ( $selector ) {
static function( $pseudo_selector ) use ( $selector ) {
return str_contains( $selector, $pseudo_selector );
}
)
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ function wp_add_global_styles_for_blocks() {
$result = array_values(
array_filter(
$metadata['path'],
function ( $item ) {
static function ( $item ) {
if ( str_contains( $item, 'core/' ) ) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -4217,7 +4217,7 @@ public function test_wp_get_loading_attr_default_should_return_false_for_special
$result = null;
add_filter(
'the_content',
function( $content ) use ( &$result, $context ) {
static function( $content ) use ( &$result, $context ) {
$result = wp_get_loading_attr_default( $context );
return $content;
}
Expand Down

0 comments on commit c7597fa

Please sign in to comment.