Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#50054 closed defect (bug) (invalid)

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

Reported by: 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
5 months 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 be 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?

Last edited 5 months ago by SergeyBiryukov (previous) (diff)

#2 @9re9re
5 months 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
5 months ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.