WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17556 closed defect (bug) (fixed)

PHP Errors on the media page in 3.1.3

Reported by: philipwalton Owned by:
Milestone: 3.1.4 Priority: normal
Severity: major Version:
Component: Query Keywords:
Focuses: Cc:

Description

I just upgraded to WordPress 3.1.3 and I'm seeing the following PHP errors with debug turned on when I click on the media page:

Warning: explode() expects parameter 2 to be string, array given in /Users/pwalton/Sites/philipwalton/wp-includes/query.php on line 2390
Warning: in_array() expects parameter 2 to be array, null given in /Users/pwalton/Sites/philipwalton/wp-includes/query.php on line 2399

I'll see if I can create a patch for them unless someone else is already working on it.

Attachments (1)

17556.diff (657 bytes) - added by nacin 3 years ago.
Do this for 3.1.4.

Download all attachments as: .zip

Change History (13)

comment:1 nacin3 years ago

Don't think is 3.1.3. Are you using WP_Query/query_posts with post_status as an array? That doesn't work (despite what the Codex once said) until 3.2. Needs to be comma-separated.

comment:2 philipwalton3 years ago

No, I just clicked on the "Media" link in the sidebar. That's where the errors showed up. This is a fresh install with no plugins activated and only the data I just imported via the WordPress importer.

It may not be 3.1.3, but I just noticed it after upgrading.

comment:3 philipwalton3 years ago

I just tried with another site I administer. No problems in 3.1.2, but as soon as I upgraded to 3.1.3, I noticed those errors on the media page.

comment:4 nacin3 years ago

You're right, thanks.

comment:5 nacin3 years ago

  • Keywords needs-patch removed
  • Milestone changed from Awaiting Review to 3.1.4
  • Severity changed from normal to blocker

We done goofed.

comment:6 nacin3 years ago

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

Backported: [18047].

comment:7 nacin3 years ago

  • Severity changed from blocker to major

Given that this did not actually break the query, I'm lowering this to major. It changes the SQL but not functionally. The only bug is an E_WARNING.

comment:8 nacin3 years ago

For the record, the 3.1.2 query:

SELECT SQL_CALC_FOUND_ROWS wp31clean_posts.* FROM wp31clean_posts WHERE 1=1 AND wp31clean_posts.post_type = 'attachment' AND (wp31clean_posts.post_status = 'inherit') ORDER BY wp31clean_posts.post_date DESC LIMIT 0, 20

The 3.1.3 query:

 SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  WHERE 1=1  AND  wp_posts.post_type = 'attachment'  ORDER BY wp_posts.post_date DESC  LIMIT 0, 20

The 3.1.4 query:

SELECT SQL_CALC_FOUND_ROWS wp31clean_posts.* FROM wp31clean_posts WHERE 1=1 AND wp31clean_posts.post_type = 'attachment' AND (wp31clean_posts.post_status = 'inherit' OR wp31clean_posts.post_status = 'private') ORDER BY wp31clean_posts.post_date DESC LIMIT 0, 20

They're all equivalent except for the private posts check now in 3.1.4, which is expected.

Version 0, edited 3 years ago by nacin (next)

nacin3 years ago

Do this for 3.1.4.

comment:9 nacin3 years ago

See #17559. Also, this bug is fixed in the Hotfix plugin: http://wordpress.org/extend/plugins/hotfix/.

comment:10 nacin3 years ago

In [18053]:

Don't use array calling for post_status in wp_edit_attachments_query() to prevent any use of the deprecated query_string filter (as in, don't use it) from tanking the page. see #17556, #17559. for 3.1.

comment:11 nacin3 years ago

In [18054]:

Don't use array calling for post_status in wp_edit_attachments_query() to prevent any use of the deprecated query_string filter (as in, don't use it) from tanking the page. see #17556, #17559. for the 3.1 branch.

Note: See TracTickets for help on using tickets.