Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gutenberg Backport: Use static closures whenever $this is not used to avoid memory leaks #4629

Closed
wants to merge 4 commits into from

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Jun 16, 2023

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.

$filter_title = function( $title, $original_title ) {
$filter_title = static function( $title, $original_title ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$filter_excerpt_more = function( $more ) use ( $more_text ) {
$filter_excerpt_more = static function( $more ) use ( $more_text ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that WordPress/gutenberg#50723 had another static addition in this file:

https://github.com/WordPress/gutenberg/blob/e3194a1d1d9869560260a3bba0939a28a52e737f/packages/block-library/src/post-excerpt/index.php#L80-L95

I guess it will come in another backport or the change in core wasn't "for-ported" to Gutenberg?

@spacedmonkey
Copy link
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()`.
  ...
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @westonruter, LGTM!

@westonruter
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

3 participants