Opened 10 years ago
Closed 8 years ago
#34437 closed defect (bug) (fixed)
The image_downsize filter in wp_prepare_attachment_for_js throws an undefined offset notice.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.3.1 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
The following code in the wp_prepare_attachment_for_js function throws an undefined offset notice...
if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) { if ( ! $downsize[3] ) continue;
When isset is added, the noticed goes away...
if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) { if ( ! isset( $downsize[3] ) ) continue;
Attachments (2)
Change History (9)
#3
@
9 years ago
- Keywords reporter-feedback added; dev-feedback removed
- Owner set to joemcgill
- Status changed from new to reviewing
#4
@
9 years ago
- Keywords reporter-feedback removed
- Milestone changed from Awaiting Review to 4.7
- Status changed from reviewing to accepted
34437.diff iterates on image_downsize.patch to use empty()
instead of ! isset()
to avoid skipping over instances where $downsize[3]
has been set to false
.
This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by helen. View the logs.
8 years ago
Note: See
TracTickets for help on using
tickets.
Good catch @justinbusa. However, wouldn't using
isset()
there make that conditional return true if$downsize[3]
were set tofalse
through a filter onimage_downsize
? Perhaps usingempty()
would be better?