Opened 7 months ago
Closed 2 months ago
#22634 closed defect (bug) (duplicate)
Plugin Editor ignores &plugin= variable
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Plugins | Version: | 3.4.2 |
| Severity: | minor | Keywords: | |
| Cc: |
Description
When a plugin is chosen and subsequently a file belonging to that plugin, a link is followed with the ?file=xx/zz&plugin=xx variables.
The plugin has the following code:
if ( isset($_REQUEST['file']) )
$plugin = stripslashes($_REQUEST['file']);
if ( empty($plugin) ) {
$plugin = array_keys($plugins);
$plugin = $plugin[0];
}
$plugin_files = get_plugin_files($plugin);
if ( empty($file) )
$file = $plugin_files[0];
else
$file = stripslashes($file);
The result is :
- The plugin select box is reset to the first plugin
- The '(active)'/'(inactive)' text does not correspond to the chosen plugin any more.
I think the code should be changed into the following:
if ( isset($_REQUEST['plugin']) )
$plugin = stripslashes($_REQUEST['plugin']);
if ( isset($_REQUEST['file']) )
$file = stripslashes($_REQUEST['file']);
if ( empty($plugin) || !in_array($plugin, array_keys($plugins)) ) {
$plugin = array_keys($plugins);
$plugin = $plugin[0];
$file = "";
}
$plugin_files = get_plugin_files($plugin);
if ( empty($file) || !in_array($file, $plugin_files) )
$file = $plugin_files[0];
I'd attach a diff, if I'd only know how to create one :-)
Change History (5)
comment:1
ZjanPreijde
— 7 months ago
comment:2
dd32
— 7 months ago
Possibly a duplicate of #17552 or that other ticket related to the plugin var..
comment:3
ZjanPreijde
— 7 months ago
Yes, you're right. The plugin editor should be changed so $plugin points to the plugin (or main plugin file), and $file to the file within the plugin. The class class-wp-plugins-list-table should still also be changed ('?plugin=') to reflect the change in the editor.
comment:4
SergeyBiryukov
— 6 months ago
#22789 was marked as a duplicate.
comment:5
SergeyBiryukov
— 2 months ago
- Keywords needs-patch removed
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
In addition, in
wp-admin/includes/class-wp-plugins-list-table, line 374, the parameter
should be changed to