[wp-trac] [WordPress Trac] #50054: Uncaught Error: [] operator not supported for strings >= PHP7.1.0

WordPress Trac noreply at wordpress.org
Sat May 2 05:30:15 UTC 2020


#50054: Uncaught Error: [] operator not supported for strings >= PHP7.1.0
--------------------------+-----------------------------
 Reporter:  9re9re        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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
 <?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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50054>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list