WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#18774 closed defect (bug) (fixed)

Notice in /wp-admin/upload.php

Reported by: juliobox Owned by: ryan
Milestone: 3.3 Priority: normal
Severity: trivial Version: 3.2.1
Component: Upload Keywords: has-patch
Focuses: Cc:

Description

Hello

wp-admin/upload.php
line 25 & 28 &30, the $post_ids var is set but only in IF statments.
so if none of this IF is TRUE we got "Notice: Undefined variable: post_ids in /wp-admin/upload.php on line XXX"
lines affected : 93, 100, 103, 110, 113, 120.

How to reproduce :

-> Notices !

Attachments (2)

18774.diff (502 bytes) - added by solarissmoke 4 years ago.
Redirect back to upload.php if no posts were selected for bulk actions
18774.patch (1.2 KB) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 @solarissmoke4 years ago

In wp-admin/edit.php and elsewhere there is a check for empty bulk edits which just redirects back to the page you were on - I think we should be doing the same here.

@solarissmoke4 years ago

Redirect back to upload.php if no posts were selected for bulk actions

comment:2 @solarissmoke4 years ago

  • Keywords has-patch added

comment:3 @SergeyBiryukov4 years ago

  • Milestone changed from Awaiting Review to 3.3

comment:4 follow-up: @ryan4 years ago

Won't that interfere with the find_detached and attach actions?

@SergeyBiryukov4 years ago

comment:5 in reply to: ↑ 4 @SergeyBiryukov4 years ago

Replying to ryan:

Won't that interfere with the find_detached and attach actions?

Indeed. We only need to check for $post_ids where it's actually used. Done in 18774.patch.

comment:6 @ryan4 years ago

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

In [18876]:

Avoid notice when performing bulk actions with now rows selected. Props SergeyBiryukov. fixes #18774

Note: See TracTickets for help on using tickets.