Make WordPress Core


Ignore:
Timestamp:
05/17/2023 10:44:21 PM (2 years ago)
Author:
westonruter
Message:

General: Use static on closures whenever $this is not used to avoid memory leaks.

Props westonruter, jrf, spacedmonkey.
Fixes #58323.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r55820 r55822  
    24062406    return array_filter(
    24072407        $nodes,
    2408         function( $node ) {
     2408        static function( $node ) {
    24092409            return ! in_array( 'blocks', $node['path'], true );
    24102410        },
     
    26362636                    add_filter(
    26372637                        'render_block',
    2638                         function( $html, $block ) use ( $block_name, $style_properties ) {
     2638                        static function( $html, $block ) use ( $block_name, $style_properties ) {
    26392639                            if ( $block['blockName'] === $block_name ) {
    26402640                                wp_enqueue_style( $style_properties['style_handle'] );
Note: See TracChangeset for help on using the changeset viewer.