[wp-trac] [WordPress Trac] #48008: 'Illegal string offset \'display_name\'',

WordPress Trac noreply at wordpress.org
Wed Sep 11 01:55:44 UTC 2019


#48008: 'Illegal string offset \'display_name\'',
--------------------------+------------------------------
 Reporter:  j3gaming      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Plugins       |     Version:  5.2.3
 Severity:  minor         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by dd32):

 > So I guess the question is, for back-compact, should the loop check if
 it's a string or a dictionary for the contributor in the loop and if a
 string revert to the old way of providing their name/avatar/link?

 Given the length of time between change and report, in this case I don't
 think I'd advocate adding any back-compat code here, especially as the
 warning will go away once the plugin in question is updated (I assume)

 Unfortunately the `plugins_api` filter isn't very forgiving, it doesn't
 really have an inbuilt method for versioning, and those who implement it
 really need to keep up-to-speed with the core changes IMHO.

 If this was reported closer to the implementation time, I'd not have been
 against writing code such as the following
 {{{
 $res = apply_filters( 'plugins_api', false, $action, $args );
 if ( $res ) {
   if ( $res['contributors'] is set and is a flat array ) {
     // "upgrade" the result to a `{ profile: .., avatar: ..default,
 disply_name: $value }`
   }
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48008#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list