Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gutenberg Backport: Use static closures whenever $this is not used to avoid memory leaks #4629

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -4048,7 +4048,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
Loading