Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 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: Focuses:

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 15 years ago.
Do this for 3.1.4.

Download all attachments as: .zip

Change History (13)

#1 @nacin
15 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.

#2 @philipwalton
15 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.

#3 @philipwalton
15 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.

#4 @nacin
15 years ago

You're right, thanks.

#5 @nacin
15 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review3.1.4
  • Severity normalblocker

We done goofed.

#6 @nacin
15 years ago

  • Resolutionfixed
  • Status newclosed

Backported: [18047].

#7 @nacin
15 years ago

  • Severity blockermajor

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.

#8 @nacin
15 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.

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

@nacin
15 years ago

Do this for 3.1.4.

#9 @nacin
15 years ago

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

#10 @nacin
15 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.

#11 @nacin
15 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.