Make WordPress Core

Changeset 56038


Ignore:
Timestamp:
06/26/2023 04:58:38 PM (2 years ago)
Author:
westonruter
Message:

Editor: Use static closures to avoid memory leaks.

Backports Gutenberg changes from https://github.com/WordPress/gutenberg/pull/50723.

Amends [55822].

Fixes #58323.
Props westonruter, spacedmonkey, flixos90.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r56028 r56038  
    24242424            array_filter(
    24252425                $element_pseudo_allowed,
    2426                 function( $pseudo_selector ) use ( $selector ) {
     2426                static function( $pseudo_selector ) use ( $selector ) {
    24272427                    return str_contains( $selector, $pseudo_selector );
    24282428                }
  • trunk/src/wp-includes/global-styles-and-settings.php

    r55988 r56038  
    371371                array_filter(
    372372                    $metadata['path'],
    373                     function ( $item ) {
     373                    static function ( $item ) {
    374374                        if ( str_contains( $item, 'core/' ) ) {
    375375                            return true;
  • trunk/tests/phpunit/tests/media.php

    r56037 r56038  
    42184218        add_filter(
    42194219            'the_content',
    4220             function( $content ) use ( &$result, $context ) {
     4220            static function( $content ) use ( &$result, $context ) {
    42214221                $result = wp_get_loading_attr_default( $context );
    42224222                return $content;
Note: See TracChangeset for help on using the changeset viewer.