Gutenberg Backport: Use static closures whenever $this is not used to avoid memory leaks#4629
Closed
westonruter wants to merge 4 commits intoWordPress:trunkfrom
Closed
Gutenberg Backport: Use static closures whenever $this is not used to avoid memory leaks#4629westonruter wants to merge 4 commits intoWordPress:trunkfrom
westonruter wants to merge 4 commits intoWordPress:trunkfrom
Conversation
westonruter
commented
Jun 16, 2023
| $show_prefix = isset( $attributes['showPrefix'] ) ? $attributes['showPrefix'] : true; | ||
| if ( ! $show_prefix ) { | ||
| $filter_title = function( $title, $original_title ) { | ||
| $filter_title = static function( $title, $original_title ) { |
Member
Author
There was a problem hiding this comment.
Note: This code doesn't exist in Gutenberg. It instead has:
westonruter
commented
Jun 16, 2023
|
|
||
| $more_text = ! empty( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . wp_kses_post( $attributes['moreText'] ) . '</a>' : ''; | ||
| $filter_excerpt_more = function( $more ) use ( $more_text ) { | ||
| $filter_excerpt_more = static function( $more ) use ( $more_text ) { |
Member
Author
There was a problem hiding this comment.
Note that WordPress/gutenberg#50723 had another static addition in this file:
I guess it will come in another backport or the change in core wasn't "for-ported" to Gutenberg?
Member
|
@westonruter All the updates to the blocks php are unneeded. When the blocks are synced as part of the release, this will happen automatically. |
…into trac-58323-2 * 'trunk' of https://github.com/WordPress/wordpress-develop: (106 commits) Twenty Nineteen: Ensure Separator block supports theme colors in editor. Tools: Fix unresolvable conflicts computation in package sync script. Twenty Twenty: Fix left margin in Latest Posts & Latest Comments blocks. Script Loader: Add support for HTML 5 "async" and "defer" attributes. Code Modernization: Use `str_contains()` in a few more places. Code Modernization: Use `str_contains()` in a few more places. Editor: rename reusable blocks to patterns. Editor: fix site editor layout bug. Editor: add support for block-level link hover colors. Upgrade/Install: Update 'show details' button change. Administration: Fix visual regression in media search input. Editor: Add no-js fallback for site editor. Upgrade/Install: Add aria-describedby for input descriptions. Administration: Consistent positioning and size of search form. Quick/Bulk Edit: Don't set publish date when editing drafts. Code Modernization: Use `str_contains()` in a few more places. Code Modernization: Use `str_starts_with()` and `str_ends_with()` in a few more places. Code Modernization: Use `str_starts_with()` and `str_ends_with()` in a few more places. Editor: Improve accessibility of new custom field UI. Coding Standards: Use Yoda condition in `str_ends_with()`. ...
felixarntz
approved these changes
Jun 26, 2023
Member
felixarntz
left a comment
There was a problem hiding this comment.
Thanks @westonruter, LGTM!
Member
Author
|
Committed in https://core.trac.wordpress.org/changeset/56038 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This backports the changes from WordPress/gutenberg#50723
See WordPress/gutenberg#51077
Trac ticket: https://core.trac.wordpress.org/ticket/58323
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.