Opened 15 years ago
Closed 15 years ago
#11241 closed defect (bug) (fixed)
Fix for undefined offset warning in do_action
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | General | Keywords: | has-patch tested commit |
Focuses: | Cc: |
Description
An unchecked index in the do_action function found in wp-includes/plugin.php can cause a huge flood of warnings depending on data feed to it.
I simply added an isset check to ensure that the use of the index doesn't occur unless something is at that array location.
Attachments (2)
Change History (6)
#1
@
15 years ago
- Keywords tested commit added
- Owner set to chrisbliss18
- Status changed from new to accepted
- Version changed from 2.9 to 3.0
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.
This plugin enables warnings and produces the warning at the top of the screen.