Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#22372 closed defect (bug) (invalid)

Bug in wp_attachment_is_image

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

Description

On wp-includes/post.php
Line 4031:

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

SHOULD BE:

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
12 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:
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/post.php#L4028

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

Note: See TracTickets for help on using tickets.