Skip to content

Conversation

@Mamaduka
Copy link
Member

What?

PR fixes a PHP warning sometimes triggered by the Comments block. I think it happens when a block is pre-rerendered for patterns.

PHP Warning:  Undefined array key "postId" in /Users/mamaduka/Projects/gutenberg/wp-content/plugins/gutenberg/build/block-library/blocks/comments.php on line 31

Why?

Block was accessing the context value before checking its existence.

Testing Instructions

  1. Open a post or page.
  2. Confirm PHP warning isn't logged.
  3. Confirm that the code update makes sense.

Testing Instructions for Keyboard

Same.

@Mamaduka Mamaduka self-assigned this Sep 24, 2025
@Mamaduka Mamaduka added the [Type] Code Quality Issues or PRs that relate to code quality label Sep 24, 2025
@Mamaduka Mamaduka requested a review from ajitbohra as a code owner September 24, 2025 03:45
@Mamaduka Mamaduka added the [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop label Sep 24, 2025
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Flaky tests detected in dc60012.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17965679890
📝 Reported issues:

@Mamaduka Mamaduka merged commit ddff046 into trunk Sep 24, 2025
75 checks passed
@Mamaduka Mamaduka deleted the fix/comments-block-php-warning branch September 24, 2025 04:58
@github-actions github-actions bot added this to the Gutenberg 21.8 milestone Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Comments Affects the Comments Block - formerly known as Comments Query Loop [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants