Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#22372 closed defect (bug) (invalid)

Bug in wp_attachment_is_image

Reported by: odedstr2 Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.4.2
Component: Media Keywords:
Focuses: Cc:


On wp-includes/post.php
Line 4031:

if ( !$file = get_attached_file( $post->ID ) )


if ( !$file = get_attached_file( $post_id ) )

By the way, the variable name $post_id is very bad, as this is the Attachment ID, not the Post ID. Probably this variable naming mistake resulted in this bug.

Change History (1)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Media
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Severity changed from major to trivial
  • Status changed from new to closed

$post->ID is actually the same value, since $post is set earlier in line 4028:

It could be $post_id as well, but there's no bug here.

Note: See TracTickets for help on using tickets.