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

Unit tests: Add coverage for reusable blocks recursion warning #920

Closed
wants to merge 1 commit into from
Closed

Unit tests: Add coverage for reusable blocks recursion warning #920

wants to merge 1 commit into from

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Jan 25, 2021

As of Gutenberg 9.8.1, it's possible to insert a reusable block into itself. This creates an infinite recursion, triggering a server error (500), and possibly crashing the editor. (We seem to encounter the latter behavior more frequently, per the recent reusable blocks refactor.)

This has been recently fixed by @mcsf in Gutenberg (WordPress/gutenberg#28405 and WordPress/gutenberg#28428). (It was then amended by WordPress/gutenberg#28461 to continue to allow rendering of multiple non-nested reusable blocks in a post.)

Reusable blocks are covered by PHP unit tests found in tests/phpunit/tests/blocks/render-reusable.php.

This PR adds tests to:

  • Ensure recursions are prevented, and that
  • Rendering of subsequent (non-nested) reusable blocks still works.

Please note that these newly added tests will currently fail (e.g. in CI), unless the aforementioned Gutenberg PRs are carried over to WordPress!

(On a sidenote, in order to prevent regressions in the future, we should consider running Core's unit tests against PRs in the Gutenberg repo, see WordPress/gutenberg#26418).

Trac ticket: https://core.trac.wordpress.org/ticket/52364

cc/ @mcsf @gziolo @sirreal


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.

@hellofromtonya
Copy link
Contributor

Closed with changeset https://core.trac.wordpress.org/changeset/50382

@ockham ockham deleted the add/reusable-blocks-recursion-test-coverage branch February 24, 2021 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants