Skip to content

Conversation

@Mamaduka
Copy link
Member

@Mamaduka Mamaduka commented Nov 12, 2025

What?

Part of #73141.

PR tries to fix warning triggered by check_is_comment_content_allowed call inside the ::update_item controller method. The warning is logged when the note is resolved or reopened.

This doesn't look like a new issue, it just more visible with Notes.

PHP Warning: Undefined array key "comment_content" in ~/gutenberg/wp-content/plugins/gutenberg/lib/compat/wordpress-6.9/class-gutenberg-rest-comment-controller-6-9.php on line 604

Why?

Users can sent partial data when updating a comment/note, this includes omitting the content. The ::update_item should account for this.

  • ::create_item sets content value to empty string when it's not included in the request. We can't do this when updating the item.
  • ::update_item has special check for when only comment status is changed, that code path never runs. The $prepared_args always includes fallback values for user ID and agent. I would like to fix this separately, will create the trac ticket.

Testing Instructions

  1. Open post or page with notes.
  2. Try resolving or reopning a note.
  3. Confirm PHP warnings aren't logged.

Testing Instructions for Keyboard

Same.

@Mamaduka Mamaduka self-assigned this Nov 12, 2025
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended REST API Interaction Related to REST API Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta [Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting labels Nov 12, 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 <[email protected]>

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

* comment_content. See wp_handle_comment_submission().
*/
return '' !== $check['comment_content'];
return ! isset( $check['comment_content'] ) || '' !== $check['comment_content'];
Copy link
Member Author

Choose a reason for hiding this comment

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

This changes behavior described in comment, but it doesn't affect anything actual.

@github-project-automation github-project-automation bot moved this to 🔎 Needs Review in WordPress 6.9 Editor Tasks Nov 12, 2025
@Mamaduka Mamaduka removed the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Nov 13, 2025
@Mamaduka Mamaduka force-pushed the fix/comments-controller-warning branch from b1abba3 to 3a3d008 Compare November 13, 2025 08:39
@Mamaduka Mamaduka added the No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core label Nov 13, 2025
@Mamaduka
Copy link
Member Author

Mamaduka commented Nov 13, 2025

I just realized this doesn't require fix in core. Props to @kadamwhite - Mamaduka/wordpress-develop@1c9e7ef.

I'll create track ticket for "::update_item has special check for when only comment status is changed"

Here's the ticket - https://core.trac.wordpress.org/ticket/64248#ticket.

@Mamaduka Mamaduka merged commit f12a701 into trunk Nov 13, 2025
37 of 38 checks passed
@Mamaduka Mamaduka deleted the fix/comments-controller-warning branch November 13, 2025 11:20
@github-actions github-actions bot added this to the Gutenberg 22.2 milestone Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting No Core Sync Required Indicates that any changes do not need to be synced to WordPress Core REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants