[wp-trac] [WordPress Trac] #32073: Undefined offset: 0 warning in wp-includes\capabilities.php on line 1119

WordPress Trac noreply at wordpress.org
Thu Apr 23 19:59:25 UTC 2015


#32073: Undefined offset: 0 warning in wp-includes\capabilities.php on line 1119
--------------------------+------------------------------
 Reporter:  hubertnguyen  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.1.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by dmchale):

 IMO a more proper fix would be to bail from each "case" which requires
 $args[0] to be set when it's not. I'm not sure quite what WordPress is
 doing when these Notices are being thrown, but I have to imagine this is
 probably cleaner? Fewer lines of code per instance, and prevents
 unnecessary calls to get_post().

 Attaching a patch that adds the following code into the `delete_page`,
 `edit_page`, `read_page`, `publish_post`, and `add_post_meta` portions of
 the switch statement.
 {{{
 if ( ! isset( $args[0] ) )
     break;
 }}}

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


More information about the wp-trac mailing list