Repository navigation
REST API: Drop redundant absint() calls on comment post and parent IDs. - #16252
adamsilverstein wants to merge 1 commit into
Conversation
The comments schema declares `post` and `parent` as integers with a minimum of 0, so the request values are already non-negative integers by the time `create_item()` and `update_item()` read them. Follow-up to [65750]. See #66635. Claude-Session: https://claude.ai/code/session_018vwYjSfCMNDQ1rP5mWYfTM
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
🟢 Approval recommended
The review identifies no active issues, and the changes consistently rely on IDs already validated by the endpoint schema.
No open issues 🎉
What changed in this PR
This PR removes redundant absint() calls from REST comment creation and update paths because the endpoint schema already validates post and parent as non-negative integers.
Changes:
- Pass validated request IDs directly to note-parent validation.
- Use validated IDs directly in reaction uniqueness and duplicate-cleanup queries.
- Remove redundant casts when determining post and parent IDs during note updates.
| File | Description |
|---|---|
| src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Removes redundant integer casts from comment creation, reaction lookup, duplicate cleanup, and note update logic. |
Review effort: Lite
Trac ticket: https://core.trac.wordpress.org/ticket/66635
Follow up to #15853 for the two review comments @westonruter left after [65750] was committed.
Claude Code (Fable 5.2) went back through the review threads on the earlier PR and wrote this up:
AI Use
Claude Code (Fable 5.2) made the change and drafted this description from the review comments. I will review and test.
🤖 Generated with Claude Code
https://claude.ai/code/session_018vwYjSfCMNDQ1rP5mWYfTM