[wp-trac] [WordPress Trac] #30958: admin.php should properly set "now" globals
WordPress Trac
noreply at wordpress.org
Thu Jan 8 22:08:00 UTC 2015
#30958: admin.php should properly set "now" globals
----------------------------+-----------------
Reporter: wonderboymusic | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.2
Component: Administration | Version:
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------
There are a handful of variables in `admin.php` which are sometimes
declared, sometimes not. Whether they are declared are not, they are
imported into other functions/methods as globals.
Begs these questions:
**Which globals are set in `admin.php`?**
`$hook_suffix`, `$plugin_page`, `$typenow`, and `$taxnow`
**How many of them have the `global` keyword?**
None.
**Is `admin.php` always in global scope?**
Yes, but it is dangerous to assume that these vars might conditionally
spill into global scope, or be set at all.
**Which globals does `admin.php` use that were defined elsewhere?**
`$pagenow`
**Where were they defined?**
`vars.php`
My patch properly globalizes them (they are indeed globals elsewhere) and
properly imports `$pagenow` from `vars.php`. `wp-
admin/includes/plugin.php` had to do an `isset()` check every time it
wanted to touch `$plugin_page`, since the variable might not even exist -
I have smoothed that out.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30958>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list