Make WordPress Core


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

    r55029 r55822  
    422422        add_filter(
    423423            'site_status_persistent_object_cache_thresholds',
    424             function() {
     424            static function() {
    425425                return array(
    426426                    'alloptions_count' => PHP_INT_MAX,
     
    473473        add_filter(
    474474            'site_status_persistent_object_cache_thresholds',
    475             function ( $thresholds ) use ( $threshold, $count ) {
     475            static function ( $thresholds ) use ( $threshold, $count ) {
    476476                return array_merge( $thresholds, array( $threshold => $count ) );
    477477            }
Note: See TracChangeset for help on using the changeset viewer.