Skip to content

fix: allow null block names in core block filter#100

Open
alceops wants to merge 2 commits into
Automattic:trunkfrom
alceops:fix-null-core-block-name-99
Open

fix: allow null block names in core block filter#100
alceops wants to merge 2 commits into
Automattic:trunkfrom
alceops:fix-null-core-block-name-99

Conversation

@alceops
Copy link
Copy Markdown

@alceops alceops commented May 8, 2026

Fixes #99.

This updates the synced-pattern inner-block filter to accept the null block names that WordPress can pass for parsed non-block/classic-content fragments. In that case the filter now returns the existing inner blocks unchanged instead of raising a PHP TypeError before the parser can continue.

I also added a focused regression test that calls the filter with a null block name.

Verification: I could not run the WordPress/PHP test suite in this cron profile because php/composer/git are not installed here. I did a static patch check against the current trunk file contents via the GitHub API.

@alceops alceops requested a review from a team as a code owner May 8, 2026 10:46
@alecgeatches
Copy link
Copy Markdown
Contributor

@alceops Thank you for the fix! I'm happy to merge, but can you address the phpcs failures in this run please? Note that the workflow didn't run automatically since you're a first-time contributor. Thank you!

FILE: tests/parser/test-inner-blocks.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 202 | ERROR | [x] The closing brace for the class must go on the next line
     |       |     after the body
     |       |     (PSR2.Classes.ClassDeclaration.CloseBraceAfterBody)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: src/parser/block-additions/core-block.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 60 | ERROR | [x] Expected 7 spaces after parameter type; 4 found
    |       |     (Squiz.Commenting.FunctionComment.SpacingAfterParamType)
 62 | ERROR | [x] Expected 4 spaces after parameter type; 1 found
    |       |     (Squiz.Commenting.FunctionComment.SpacingAfterParamType)
 63 | ERROR | [x] Expected 7 spaces after parameter type; 4 found
    |       |     (Squiz.Commenting.FunctionComment.SpacingAfterParamType)
--------------------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants