#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: |
Description
When filtering category with tag via url, say,
http://your.domain/category/blog/?tag=wicked
code reaches here: (I point specific version for future reference but this is also true for the current trunk)
https://core.trac.wordpress.org/browser/branches/5.4/src/wp-includes/class-wp-query.php#L1253
For PHP >= 7.1.0
Array initialization required for [] operator. I personally fixed only this line but code like
<?php // 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)
Note: See
TracTickets for help on using
tickets.
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?