Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#50054 closed defect (bug) (invalid)

Uncaught Error: [] operator not supported for strings >= PHP7.1.0

Reported by: 9re9re's profile 9re9re Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.5
Component: Query Keywords:
Focuses: Cc:


When filtering category with tag via url, say,


code reaches here: (I point specific version for future reference but this is also true for the current trunk)

For PHP >= 7.1.0
Array initialization required for [] operator. I personally fixed only this line but code like

// initialization required: $something = array();
$something[] = 'brabrabra';

is wide spread so I made this ticket for more general solution than my monkey ad hoc patching.
Like make some utility function and use it everywhere.

Change History (3)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Query
  • Keywords reporter-feedback added

Hi there, welcome to WordPress Trac! Thanks for the report.

I could not reproduce the issue on a clean install. There is some code in WP_Query::fill_query_var() to make sure every parameter that should an array is properly initialized as such.

Inspecting the value of $q['tag_slug__in'] just before line 1253 shows that it is in fact an array.

It looks like there is some code on your install that passes a string value to the tag_slug__in parameter.

Does the issue still happen with all plugins disabled and a default theme (Twenty Twenty) activated?

Version 0, edited 4 years ago by SergeyBiryukov (next)

#2 @9re9re
4 years ago

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


Thanks for the quick response, I've never tried the default theme, and if tried it works!
So this issue must be related to the theme I'm using and this ticket can be closed.


#3 @SergeyBiryukov
4 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.