Commit c7082d6f63 for wordpress.org
commit c7082d6f63ff4c38af1b31b54553eb1d1d005a4f
Author: adamsilverstein <adamsilverstein@git.wordpress.org>
Date: Thu Dec 3 00:18:53 2026 +0000
REST API: Drop redundant `absint()` calls on comment post and parent IDs.
The comments schema declares `post` and `parent` as integers with a minimum of 0, so the request values are already non-negative integers when `create_item()` and `update_item()` read them.
Follow-up to [65750].
Props westonruter.
See #66635.
Built from https://develop.svn.wordpress.org/trunk@65871
git-svn-id: http://core.svn.wordpress.org/trunk@64900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index 3bb4405905..8cea8567f1 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
@@ -732,7 +732,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
}
if ( 'note' === $request['type'] && $request['parent'] ) {
- $parent_check = $this->check_note_parent( absint( $request['parent'] ), absint( $request['post'] ) );
+ $parent_check = $this->check_note_parent( $request['parent'], $request['post'] );
if ( is_wp_error( $parent_check ) ) {
return $parent_check;
@@ -854,7 +854,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
*/
$existing = get_comments(
array(
- 'post_id' => absint( $request['post'] ),
+ 'post_id' => $request['post'],
'parent' => $request['parent'],
'user_id' => get_current_user_id(),
'type' => 'reaction',
@@ -1045,7 +1045,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
if ( null !== $reaction_key ) {
$matching = get_comments(
array(
- 'post_id' => absint( $request['post'] ),
+ 'post_id' => $request['post'],
'parent' => $request['parent'],
'user_id' => get_current_user_id(),
'type' => 'reaction',
@@ -1245,8 +1245,8 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
}
if ( 'note' === $comment->comment_type ) {
- $post_id = isset( $request['post'] ) ? absint( $request['post'] ) : (int) $comment->comment_post_ID;
- $parent_id = isset( $request['parent'] ) ? absint( $request['parent'] ) : (int) $comment->comment_parent;
+ $post_id = isset( $request['post'] ) ? $request['post'] : (int) $comment->comment_post_ID;
+ $parent_id = isset( $request['parent'] ) ? $request['parent'] : (int) $comment->comment_parent;
$is_moving = $post_id !== (int) $comment->comment_post_ID;
if ( $parent_id && ( $is_moving || $parent_id !== (int) $comment->comment_parent ) ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index afe99126cd..c1278bb58e 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.3-alpha-65870';
+$wp_version = '7.3-alpha-65871';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.