Make WordPress Core


Ignore:
Timestamp:
05/17/2023 10:44:21 PM (3 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/tests/phpunit/tests/media.php

    r55821 r55822  
    23492349                add_filter(
    23502350                        'wp_content_img_tag',
    2351                         function( $filtered_image ) {
     2351                        static function( $filtered_image ) {
    23522352                                return "<span>$filtered_image</span>";
    23532353                        }
    … …  
    23732373                add_filter(
    23742374                        'wp_content_img_tag',
    2375                         function( $filtered_image ) {
     2375                        static function( $filtered_image ) {
    23762376                                return "<span>$filtered_image</span>";
    23772377                        }
    … …  
    37623762                add_filter(
    37633763                        'wp_get_attachment_image_attributes',
    3764                         function( $attr ) {
     3764                        static function( $attr ) {
    37653765                                unset( $attr['srcset'], $attr['sizes'], $attr['decoding'] );
    37663766                                return $attr;
Note: See TracChangeset for help on using the changeset viewer.