Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21835 closed defect (bug) (fixed)

wp_mime_type_icon() does wp_cache_set() when it should do wp_cache_add()

Reported by: nacin Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:


Really no reason for it to try an unconditional set, as it is only run when the get failed.

Additionally, $post_id is not set when passed to the filter if the get succeeds, as noted by koopersmith.

Change History (3)

#1 @koopersmith
3 years ago

In [21782]:

Ensure $post_id is defined in wp_mime_type_icon() to prevent notices when a valid mime type string is provided. see #21835.

#2 @nacin
3 years ago

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

In [21783]:

Use wp_cache_add() in wp_mime_type_icon(). fixes #21835.

#3 @sc0ttkclark
3 years ago

The $post_id PHP notice was ticketed in #21614 (just putting it here so they can get linked together, as this one was the one where the fix was committed)

Note: See TracTickets for help on using tickets.