[wp-trac] [WordPress Trac] #28102: is_string check in validate_file
WordPress Trac
noreply at wordpress.org
Sat May 3 00:39:17 UTC 2014
#28102: is_string check in validate_file
----------------------------------+-----------------------------
Reporter: IwanLuijksQuestMedia | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.0
Component: Plugins | Version: 2.2
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration
----------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* keywords: => has-patch
* version: 3.9 => 2.2
* milestone: Awaiting Review => 4.0
Comment:
Replying to [comment:1 IwanLuijksQuestMedia]:
> This happens when in the plugin itself you use the variable $plugin
Confirmed. `$plugin = array()` in a plugin file causes a bunch of notices
on activation:
{{{
Notice: Array to string conversion in S:\home\wordpress\trunk\wp-
includes\functions.php on line 3346
Notice: Array to string conversion in S:\home\wordpress\trunk\wp-
includes\functions.php on line 3349
Notice: Array to string conversion in S:\home\wordpress\trunk\wp-
includes\functions.php on line 3355
Notice: Array to string conversion in S:\home\wordpress\trunk\wp-
includes\load.php on line 507
Notice: Array to string conversion in S:\home\wordpress\trunk\wp-
includes\functions.php on line 3346
Notice: Array to string conversion in S:\home\wordpress\trunk\wp-
includes\functions.php on line 3349
Notice: Array to string conversion in S:\home\wordpress\trunk\wp-
includes\functions.php on line 3355
Warning: Illegal offset type in S:\home\wordpress\trunk\wp-
admin\includes\plugin.php on line 874
}}}
It also leads to a corrupted `active_plugins` option, which can only be
fixed by a manual reset:
{{{
Array(
[0] => akismet/akismet.php
[1] => debug-bar/debug-bar.php
[2] => hello.php
[3] => Array()
)
}}}
This is caused by accidentally overriding the local `$plugin` variable in
`activate_plugin()`:
[source:tags/3.9/src/wp-admin/includes/plugin.php#L536].
Appears to be introduced in [4811], which changed the calling sequence.
Also related: #6308.
[attachment:28102.patch] fixes this by using a more unique name,
`$_wp_plugin_file`, to restore the previous value.
We could probably just replace all instances or `$plugin` in
`activate_plugin()` with `$_wp_plugin_file`, but `$plugin` seems more
readable.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28102#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list