[wp-trac] [WordPress Trac] #52364: Reusable blocks: Add tests for recursion, subsequent instances

WordPress Trac noreply at wordpress.org
Mon Jan 25 17:27:59 UTC 2021


#52364: Reusable blocks: Add tests for recursion, subsequent instances
-----------------------------+-----------------------------
 Reporter:  Bernhard Reiter  |      Owner:  (none)
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 As of Gutenberg 9.8.1, it's possible to insert a reusable block into
 itself. This creates an infinite recursion,
 [https://github.com/WordPress/gutenberg/issues/18704 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]https://github.com/WordPress/gutenberg/pull/27887.)

 This has been recently fixed in Gutenberg
 ([https://github.com/WordPress/gutenberg/pull/28405 gb#28405] and
 [https://github.com/WordPress/gutenberg/pull/28428 gb#28428]). (It was
 then amended by [https://github.com/WordPress/gutenberg/pull/28461
 gb#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
 [https://github.com/WordPress/wordpress-
 develop/blob/9983be3248ea497ecb001be82c618c7849d3c51f/tests/phpunit/tests/blocks
 /render-reusable.php `tests/phpunit/tests/blocks/render-reusable.php`].

 We should add tests to:
 - Ensure recursions are prevented, and that
 - Rendering of subsequent (non-nested) reusable blocks still works.

 I have a diff ready that I'll file as a PR against the `wordpress-develop`
 repo shortly.

 (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
 [https://github.com/WordPress/gutenberg/issues/26418 gb#26418]).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52364>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list