<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[55822] trunk: General: Use `static` on closures whenever `$this` is not used to avoid memory leaks.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/55822">55822</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/55822","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>westonruter</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-05-17 22:44:21 +0000 (Wed, 17 May 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>General: Use `static` on closures whenever `$this` is not used to avoid memory leaks.

Props westonruter, jrf, spacedmonkey.
Fixes <a href="https://core.trac.wordpress.org/ticket/58323">#58323</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesfilephp">trunk/src/wp-admin/includes/file.php</a></li>
<li><a href="#trunksrcwpincludesblocksphp">trunk/src/wp-includes/blocks.php</a></li>
<li><a href="#trunksrcwpincludesclasswpqueryphp">trunk/src/wp-includes/class-wp-query.php</a></li>
<li><a href="#trunksrcwpincludesksesphp">trunk/src/wp-includes/kses.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestmenuitemscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestmenuscontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
<li><a href="#trunktestsperformancewpcontentmupluginsservertimingphp">trunk/tests/performance/wp-content/mu-plugins/server-timing.php</a></li>
<li><a href="#trunktestsphpunittestsadminwpSiteHealthphp">trunk/tests/phpunit/tests/admin/wpSiteHealth.php</a></li>
<li><a href="#trunktestsphpunittestsblockseditorphp">trunk/tests/phpunit/tests/blocks/editor.php</a></li>
<li><a href="#trunktestsphpunittestsblocksrenderCommentTemplatephp">trunk/tests/phpunit/tests/blocks/renderCommentTemplate.php</a></li>
<li><a href="#trunktestsphpunittestsblockswpBlockphp">trunk/tests/phpunit/tests/blocks/wpBlock.php</a></li>
<li><a href="#trunktestsphpunittestsdependenciesscriptsphp">trunk/tests/phpunit/tests/dependencies/scripts.php</a></li>
<li><a href="#trunktestsphpunittestsgeneralwpPreloadResourcesphp">trunk/tests/phpunit/tests/general/wpPreloadResources.php</a></li>
<li><a href="#trunktestsphpunittestsksesphp">trunk/tests/phpunit/tests/kses.php</a></li>
<li><a href="#trunktestsphpunittestsmediaphp">trunk/tests/phpunit/tests/media.php</a></li>
<li><a href="#trunktestsphpunittestspluggablewpMailphp">trunk/tests/phpunit/tests/pluggable/wpMail.php</a></li>
<li><a href="#trunktestsphpunittestsquerystickiesphp">trunk/tests/phpunit/tests/query/stickies.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestserverphp">trunk/tests/phpunit/tests/rest-api/rest-server.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestthemescontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php</a></li>
<li><a href="#trunktestsphpunitteststhemewpThemeJsonResolverphp">trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesfilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/file.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/file.php      2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/src/wp-admin/includes/file.php        2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2685,7 +2685,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *                        with sub-directories represented as nested arrays.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $path    Absolute path to the directory.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $invalidate_directory = function( $dirlist, $path ) use ( &$invalidate_directory ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $invalidate_directory = static function( $dirlist, $path ) use ( &$invalidate_directory ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $path = trailingslashit( $path );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( $dirlist as $name => $details ) {
</span></span></pre></div>
<a id="trunksrcwpincludesblocksphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/blocks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/blocks.php  2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/src/wp-includes/blocks.php    2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -485,7 +485,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                         *
</span><span class="cx" style="display: block; padding: 0 10px">                         * @return string Returns the block content.
</span><span class="cx" style="display: block; padding: 0 10px">                         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $settings['render_callback'] = function( $attributes, $content, $block ) use ( $template_path ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $settings['render_callback'] = static function( $attributes, $content, $block ) use ( $template_path ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ob_start();
</span><span class="cx" style="display: block; padding: 0 10px">                                require $template_path;
</span><span class="cx" style="display: block; padding: 0 10px">                                return ob_get_clean();
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-query.php  2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/src/wp-includes/class-wp-query.php    2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4826,7 +4826,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                         * $value is passed by reference to allow it to be modified.
</span><span class="cx" style="display: block; padding: 0 10px">                         * array_walk_recursive() does not return an array.
</span><span class="cx" style="display: block; padding: 0 10px">                         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function ( &$value ) use ( $wpdb, $placeholder ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function ( &$value ) use ( $wpdb, $placeholder ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( is_string( $value ) && str_contains( $value, $placeholder ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $value = $wpdb->remove_placeholder_escape( $value );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span></span></pre></div>
<a id="trunksrcwpincludesksesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/kses.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/kses.php    2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/src/wp-includes/kses.php      2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1177,7 +1177,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        // Check if there are attributes that are required.
</span><span class="cx" style="display: block; padding: 0 10px">        $required_attrs = array_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                $allowed_html[ $element_low ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                function( $required_attr_limits ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         static function( $required_attr_limits ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return isset( $required_attr_limits['required'] ) && true === $required_attr_limits['required'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestmenuitemscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php  2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php    2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -792,7 +792,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'context'     => array( 'view', 'edit', 'embed' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'arg_options' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'sanitize_callback' => function ( $value ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'sanitize_callback' => static function ( $value ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -873,7 +873,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'context'     => array( 'view', 'edit', 'embed' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'arg_options' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'sanitize_callback' => function ( $value ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'sanitize_callback' => static function ( $value ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestmenuscontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php       2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php 2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -534,7 +534,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'context'     => array( 'view', 'edit' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'arg_options' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'validate_callback' => function ( $locations, $request, $param ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'validate_callback' => static function ( $locations, $request, $param ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $valid = rest_validate_request_arg( $locations, $request, $param );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        if ( true !== $valid ) {
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php   2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/src/wp-includes/script-loader.php     2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2405,7 +2405,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_filter_out_block_nodes( $nodes ) {
</span><span class="cx" style="display: block; padding: 0 10px">        return array_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                $nodes,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                function( $node ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         static function( $node ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return ! in_array( 'blocks', $node['path'], true );
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px">                ARRAY_FILTER_USE_BOTH
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2635,7 +2635,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( wp_should_load_separate_core_block_assets() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                                                'render_block',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                function( $html, $block ) use ( $block_name, $style_properties ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         static function( $html, $block ) use ( $block_name, $style_properties ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         if ( $block['blockName'] === $block_name ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                                wp_enqueue_style( $style_properties['style_handle'] );
</span><span class="cx" style="display: block; padding: 0 10px">                                                        }
</span></span></pre></div>
<a id="trunktestsperformancewpcontentmupluginsservertimingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/wp-content/mu-plugins/server-timing.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/wp-content/mu-plugins/server-timing.php   2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/performance/wp-content/mu-plugins/server-timing.php     2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,7 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> add_action(
</span><span class="cx" style="display: block; padding: 0 10px">        'template_redirect',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ static function() {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                global $timestart;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,7 +15,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                add_action(
</span><span class="cx" style="display: block; padding: 0 10px">                        'shutdown',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function() use ( $server_timing_values, $template_start ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function() use ( $server_timing_values, $template_start ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                global $timestart;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsadminwpSiteHealthphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/admin/wpSiteHealth.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/admin/wpSiteHealth.php  2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/admin/wpSiteHealth.php    2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -421,7 +421,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Set thresholds so high they should never be exceeded.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'site_status_persistent_object_cache_thresholds',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'alloptions_count' => PHP_INT_MAX,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'alloptions_bytes' => PHP_INT_MAX,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -472,7 +472,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_object_cache_thresholds( $threshold, $count ) {
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'site_status_persistent_object_cache_thresholds',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function ( $thresholds ) use ( $threshold, $count ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function ( $thresholds ) use ( $threshold, $count ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return array_merge( $thresholds, array( $threshold => $count ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span></span></pre></div>
<a id="trunktestsphpunittestsblockseditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/blocks/editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/editor.php       2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/blocks/editor.php 2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -302,7 +302,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Force the return value of wp_max_upload_size() to be 500.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'upload_size_limit',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return 500;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span></span></pre></div>
<a id="trunktestsphpunittestsblocksrenderCommentTemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/blocks/renderCommentTemplate.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/renderCommentTemplate.php        2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/blocks/renderCommentTemplate.php  2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -436,7 +436,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $commenter_filter = function () {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $commenter_filter = static function () {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'comment_author_email' => 'unapproved@example.org',
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span></span></pre></div>
<a id="trunktestsphpunittestsblockswpBlockphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/blocks/wpBlock.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/wpBlock.php      2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/blocks/wpBlock.php        2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -693,7 +693,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->registry->register(
</span><span class="cx" style="display: block; padding: 0 10px">                        'core/outer',
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'render_callback' => function( $block_attributes, $content ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'render_callback' => static function( $block_attributes, $content ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         return $content;
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -702,7 +702,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->registry->register(
</span><span class="cx" style="display: block; padding: 0 10px">                        'core/inner',
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'render_callback' => function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'render_callback' => static function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         return 'b';
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span></span></pre></div>
<a id="trunktestsphpunittestsdependenciesscriptsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/dependencies/scripts.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/dependencies/scripts.php        2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/dependencies/scripts.php  2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1473,7 +1473,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                wp_set_script_translations( 'common' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $print_scripts = get_echo(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_print_scripts();
</span><span class="cx" style="display: block; padding: 0 10px">                                _print_scripts();
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span></span></pre></div>
<a id="trunktestsphpunittestsgeneralwpPreloadResourcesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/general/wpPreloadResources.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/general/wpPreloadResources.php  2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/general/wpPreloadResources.php    2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,7 +14,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 42438
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_preload_resources( $expected, $preload_resources ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $callback = function () use ( $preload_resources ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $callback = static function () use ( $preload_resources ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return $preload_resources;
</span><span class="cx" style="display: block; padding: 0 10px">                };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsksesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/kses.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/kses.php        2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/kses.php  2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1923,7 +1923,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return array_map(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function ( $datum ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function ( $datum ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $datum[] = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'p' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                                'dir' => array(
</span></span></pre></div>
<a id="trunktestsphpunittestsmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/media.php       2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/media.php 2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2348,7 +2348,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp_content_img_tag',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function( $filtered_image ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function( $filtered_image ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return "<span>$filtered_image</span>";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2372,7 +2372,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp_content_img_tag',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function( $filtered_image ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function( $filtered_image ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return "<span>$filtered_image</span>";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3761,7 +3761,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp_get_attachment_image_attributes',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function( $attr ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function( $attr ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 unset( $attr['srcset'], $attr['sizes'], $attr['decoding'] );
</span><span class="cx" style="display: block; padding: 0 10px">                                return $attr;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span></span></pre></div>
<a id="trunktestsphpunittestspluggablewpMailphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/pluggable/wpMail.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/pluggable/wpMail.php    2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/pluggable/wpMail.php      2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -538,7 +538,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * Tests that AltBody is reset between each wp_mail call.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_mail_resets_properties() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $wp_mail_set_text_message = function ( $phpmailer ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $wp_mail_set_text_message = static function ( $phpmailer ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $phpmailer->AltBody = 'user1';
</span><span class="cx" style="display: block; padding: 0 10px">                };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsquerystickiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/query/stickies.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/query/stickies.php      2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/query/stickies.php        2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -136,7 +136,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $post_ids     = self::factory()->post->create_many( $sticky_count, array( 'post_date' => $post_date ) );
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'pre_option_sticky_posts',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function () use ( $post_ids ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function () use ( $post_ids ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return $post_ids;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestserverphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-server.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-server.php        2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/rest-api/rest-server.php  2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -937,7 +937,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 56566
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_link_embedding_returning_wp_error() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $return_wp_error = function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $return_wp_error = static function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return new WP_Error( 'some-error', 'This is not valid!' );
</span><span class="cx" style="display: block; padding: 0 10px">                };
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'rest_pre_dispatch', $return_wp_error );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2188,7 +2188,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'methods'             => \WP_REST_Server::READABLE,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'callback'            => function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'callback'            => static function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 return new \WP_REST_Response( INF );
</span><span class="cx" style="display: block; padding: 0 10px">                                        },
</span><span class="cx" style="display: block; padding: 0 10px">                                        'permission_callback' => '__return_true',
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestthemescontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php     2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php       2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1384,7 +1384,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'wp/v2',
</span><span class="cx" style="display: block; padding: 0 10px">                        sprintf( '/themes/(?P<stylesheet>%s)//test', WP_REST_Themes_Controller::PATTERN ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'callback'            => function ( WP_REST_Request $request ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'callback'            => static function ( WP_REST_Request $request ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         return $request['stylesheet'];
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                'permission_callback' => '__return_true',
</span></span></pre></div>
<a id="trunktestsphpunitteststhemewpThemeJsonResolverphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php   2023-05-17 18:29:41 UTC (rev 55821)
+++ trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php     2023-05-17 22:44:21 UTC (rev 55822)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -600,7 +600,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $global_styles_query_count = 0;
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter(
</span><span class="cx" style="display: block; padding: 0 10px">                        'query',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        function( $query ) use ( &$global_styles_query_count ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 static function( $query ) use ( &$global_styles_query_count ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( preg_match( '#post_type = \'wp_global_styles\'#', $query ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $global_styles_query_count++;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span></span></pre>
</div>
</div>

</body>
</html>