Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#17556 closed defect (bug) (fixed)

PHP Errors on the media page in 3.1.3

Reported by: philipwalton Owned by:
Priority: normal Milestone: 3.1.4
Component: Query Version:
Severity: major Keywords:
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 2 years ago.
Do this for 3.1.4.

Download all attachments as: .zip

Change History (13)

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.

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.

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.

You're right, thanks.

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

We done goofed.

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

Backported: [18047].

  • 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.

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.

Last edited 2 years ago by nacin (previous) (diff)

nacin2 years ago

Do this for 3.1.4.

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

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.

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.