Make WordPress Core


Ignore:
Timestamp:
05/17/2023 10:44:21 PM (16 months 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/blocks.php

    r55762 r55822  
    486486             * @return string Returns the block content.
    487487             */
    488             $settings['render_callback'] = function( $attributes, $content, $block ) use ( $template_path ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
     488            $settings['render_callback'] = static function( $attributes, $content, $block ) use ( $template_path ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
    489489                ob_start();
    490490                require $template_path;
Note: See TracChangeset for help on using the changeset viewer.