Opened 9 years ago
Closed 7 years ago
#38874 closed defect (bug) (fixed)
Change include of "includes/plugin-install.php" to include_once
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.3 | Priority: | normal |
| Severity: | normal | Version: | 3.1 |
| Component: | Plugins | Keywords: | has-patch needs-testing |
| Focuses: | administration | Cc: |
Description
The file wp-admin/includes/plugin-install.php, which contains only functions and does not directly execute anything, is included from 4 different files:
- wp-admin/includes/ajax-actions.php - using
include_once - wp-admin/includes/class-wp-plugin-install-list-table.php - using
include - wp-admin/update-core.php - using
require_once - wp-admin/update.php - using
include_once
The second yields problems when including wp-admin/includes/plugin-install.php using custom code, as the unconditional include will then yield a fatal error ("Cannot redeclare plugins_api()").
The include should be changed to include_once.
Attachments (1)
Change History (4)
#2
@
7 years ago
- Keywords has-patch needs-testing added
- Milestone changed from Awaiting Review to 5.3
- Version changed from 4.6.1 to 3.1
Hi @engelen,
First off, sorry that it took so long or someone to get back to you on this.
I've done some digging to connect the dots on some history. For reference, here is what I found:
- The
include_onceinwp-admin/includes/ajax-actions.phpwas introduced in [37714] for version 4.6. - The
includeinwp-admin/includes/class-wp-plugin-install-list-table.phpwas introduced in [15491] for version 3.1. - The
require_onceinwp-admin/update-core.phpwas introduced in [12157] for version 2.9. - The
include_onceinwp-admin/update.phpwas introduced in [11005] for version 2.8 (formatting modified in [28500]).
The patch still applies for me, and this makes sense. I am going to milestone this for the next release to get it some attention, testing, and feedback.
Change "include" to "include-once" for including "wp-admin/includes/plugin-install.php" in "wp-admin/includes/class-wp-plugin-install-list-table.php"