Skip to content

fix: 🐛 Use block name instead of path in Assets_Enqueuer to prevent PHP 8.1 fatal error#93

Merged
knice merged 1 commit intomainfrom
hotfix--knice-asset-enqueuer-php81
Mar 24, 2026
Merged

fix: 🐛 Use block name instead of path in Assets_Enqueuer to prevent PHP 8.1 fatal error#93
knice merged 1 commit intomainfrom
hotfix--knice-asset-enqueuer-php81

Conversation

@knice
Copy link
Copy Markdown
Member

@knice knice commented Mar 23, 2026

What does this do/fix?

$block->path can be null for some registered blocks, causing explode() to throw a TypeError in PHP 8.1+. $block->name is always set and already used in the filter, making it a more reliable source for extracting the block name.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Tests and who has completed them

Download and build this branch (npm i and composer install), add a news block, and class schedule block to a page your site.

…HP 8.1 fatal error

$block->path can be null for some registered blocks, causing
explode() to throw a TypeError in PHP 8.1+. $block->name is
always set and already used in the filter, making it a more
reliable source for extracting the block name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@knice knice requested a review from Herm71 March 23, 2026 23:32
@knice knice added the change Change to an existing but not broken feature label Mar 23, 2026
@knice
Copy link
Copy Markdown
Member Author

knice commented Mar 24, 2026

Context: I was experimenting with test WordPress environments, but kept getting a fatal error when the CF plugin was turned on. It turned out that this issue caused PHP to choke. Claude found and fixed the issue, which makes the plugin use a more reliable method of getting a block's name.

Copy link
Copy Markdown
Member

@Herm71 Herm71 left a comment

Choose a reason for hiding this comment

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

Works as advertised! 👍

Copy link
Copy Markdown
Member

@Herm71 Herm71 left a comment

Choose a reason for hiding this comment

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

👍

@knice knice merged commit f6100e8 into main Mar 24, 2026
@knice knice deleted the hotfix--knice-asset-enqueuer-php81 branch March 24, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change Change to an existing but not broken feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants