Don't improperly cast IDs when fetching post, user, or term objects.
Blindly casting passed IDs to integers can generate false positives when the ID is cast to `1`. Props deeptiboddapati. Fixes #37738. Built from https://develop.svn.wordpress.org/trunk@38381 git-svn-id: http://core.svn.wordpress.org/trunk@38322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -191,11 +191,12 @@ final class WP_Comment {
|
||||
public static function get_instance( $id ) {
|
||||
global $wpdb;
|
||||
|
||||
$comment_id = (int) $id;
|
||||
if ( ! $comment_id ) {
|
||||
if ( ! is_numeric( $id ) || $id != floor( $id ) || ! $id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$comment_id = (int) $id;
|
||||
|
||||
$_comment = wp_cache_get( $comment_id, 'comment' );
|
||||
|
||||
if ( ! $_comment ) {
|
||||
|
||||
Reference in New Issue
Block a user