Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32948 closed defect (bug) (fixed)

media_upload_header() outputs unenclosed post_type string

Reported by: kylegilman's profile kylegilman Owned by: obenland's profile obenland
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.3
Component: Media Keywords: has-patch commit
Focuses: javascript, administration Cc:

Description

I'm seeing "Uncaught ReferenceError: post is not defined" in the JavaScript console whenever I load a custom Media Upload tab. I looked into it and the media_upload_header() function at source:trunk/src/wp-admin/includes/media.php@32964#L1752 adds the post_type as a JavaScript variable without enclosing it in quotes. In previous versions of WordPress it only output the post_id which is also not enclosed, but it's an integer so there wasn't an error.

Attachments (1)

32948.diff (783 bytes) - added by obenland 9 years ago.

Download all attachments as: .zip

Change History (5)

#1 @johnbillion
9 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.3

Introduced in r32673 as part of #19257 which ended up being pretty buggy.

This variable can be removed entirely as per r32676.

@obenland
9 years ago

#2 @obenland
9 years ago

  • Keywords has-patch added; needs-patch removed

@johnbillion, is 32948.diff what you had in mind?

#3 @johnbillion
9 years ago

  • Keywords commit added

Yep.

#4 @obenland
9 years ago

  • Owner set to obenland
  • Resolution set to fixed
  • Status changed from new to closed

In 33263:

Media: Remove post_type variable, unused since [32676].

Fixes #32948.

Note: See TracTickets for help on using tickets.