[wp-trac] [WordPress Trac] #11241: Fix for undefined offset warning in do_action

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 25 17:46:21 UTC 2010


#11241: Fix for undefined offset warning in do_action
--------------------------+-------------------------------------------------
 Reporter:  chrisbliss18  |       Owner:  chrisbliss18           
     Type:  defect (bug)  |      Status:  accepted               
 Priority:  normal        |   Milestone:                         
Component:  General       |     Version:  3.0                    
 Severity:  normal        |    Keywords:  has-patch tested commit
--------------------------+-------------------------------------------------
Changes (by chrisbliss18):

  * keywords:  has-patch => has-patch tested commit
  * owner:  => chrisbliss18
  * version:  2.9 => 3.0
  * status:  new => accepted


Comment:

 This problem is still in trunk as of r13402. I've added a plugin that
 shows how this warning can be produced. It's basically an unchecked
 potential $arg value that causes this.

 The following criteria must be met for this warning to be produced:
 * The called action tag must have at least one function attached to it.
 * The second argument passed to the do_action function (the $arg value)
 must be an array with only one entry with an index other than 0.

 When these criteria is met, the is_object($arg[0]) portion of the code
 throws a warning since the conditional has not confirmed that $arg[0]
 exists first.

 My patch simply confirms that $arg[0] is set before checking it, thus
 removing the warning.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11241#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list