Make WordPress Core

Opened 20 years ago

Closed 20 years ago

Last modified 20 years ago

#3642 closed defect (bug) (fixed)

"Fatal error: [] operator not supported for strings in wp-includes/classes.php on line 402" after upgrade to 2.1

Reported by: gregh Owned by: ryan
Priority: low Milestone: 2.1.1
Component: Administration Version: 2.1
Severity: normal Keywords: has-patch needs-testing 2nd-opinion dev-feedback
Cc: Focuses:

Description

I just performed an upgrade to 2.1 and when I try to go to "Admin -> Manage -> Posts" I get the following error:

"Fatal error: [] operator not supported for strings in /path_to_wp/wp-includes/classes.php on line 402"

The last thing printed to the browser prior to the error was "Browse category:", the rest of the page is blank. This makes managing posts impossible, so it is a pretty big deal.

So it seems that the minimum PHP version requirement was bumped in this release but the release notes don't mention this at all. So this either WordPress itself or the release notes need to be fixed.

For reference, I am running Red Hat Enterprise Linux (ES3), and the latest version of PHP supplied by Red Hat (with backported security patches) is PHP 4.3.2. The only active plugin is Akismet.

Attachments (1)

walk_array_check.diff (502 bytes ) - added by charleshooper 20 years ago.

Download all attachments as: .zip

Change History (10)

#1 @ryan
20 years ago

The required PHP ersion vhas not been bumped. For some reason, Walker::walk() is being passed a string instead of an array.

#2 @foolswisdom
20 years ago

  • Version2.1

#3 @markjaquith
20 years ago

  • Owner changed from anonymous to ryan

Tracing this backwards, I've gotten this far:

category-template.php:182 must be returning non-array

$categories = get_categories($r);

So the bug is probably there. get_categories should probably return blank array() if it has no results.

#4 @foolswisdom
20 years ago

  • Milestone 2.22.1.1

#5 @charleshooper
20 years ago

  • Keywords has-patch needs-testing 2nd-opinion dev-feedback added

I can't reproduce this but I decided to poke around and take a look anyways. get_categories() actually DOES return a blank array if it doesn't have any resultsp

        if ( empty($categories) )
                return array();

I can't really figure out how or why Walker:walk() is being passed a string instead of an array, but if we can get rid of that ugly fatal error then we can at least get our users able to manage their posts.

#6 @markjaquith
20 years ago

  • Resolutionfixed
  • Status newclosed

99% sure this was being caused by the bug fixed here. [4856] [4857]

A definite symptom of the bug was get_categories() returning a blank string.

#7 in reply to: ↑ description @gregh
20 years ago

Would you like me to test whether these fixes have any impact?

Should I try out walk_array_check.diff, or the fixes from changesets [4856] and [4857], or both?

My understanding is that those changesets should be enough, right?

#8 @foolswisdom
20 years ago

gregh, it would be awesome if you can try the changeset for your version either 2.1 or trunk. Sounds like that should be enough.

#9 @gregh
20 years ago

Ok, I tried the changeset for the 2.1 branch [4857] and can confirm that the error has gone away.

Note: See TracTickets for help on using tickets.