Opened 11 years ago
Closed 10 years ago
#34437 closed defect (bug) (fixed)
The image_downsize filter in wp_prepare_attachment_for_js throws an undefined offset notice.
| Reported by: | justinbusa | Owned by: | joemcgill |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.7 |
| Component: | Media | Version: | 4.3.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
10 years ago
- Keywords reporter-feedback added; dev-feedback removed
- Owner set to
- Status new → reviewing
#4
@
10 years ago
- Keywords reporter-feedback removed
- Milestone Awaiting Review → 4.7
- Status reviewing → 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.
10 years ago
This ticket was mentioned in Slack in #core by helen. View the logs.
10 years ago
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Good catch @justinbusa. However, wouldn't using
isset()there make that conditional return true if$downsize[3]were set tofalsethrough a filter onimage_downsize? Perhaps usingempty()would be better?