Opened 12 years ago
Closed 12 years ago
#26867 closed defect (bug) (fixed)
Explicitly globalize some missing query globals in wp-settings.php
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Unit Tests | Keywords: | has-patch |
| Focuses: | Cc: |
Description
When WordPress is loaded in a function (e.g. unit tests) the variables initialized at the top level aren't globals, but we expect them to be.
For example, if in a unit test there is no way to access $wp_query, either directly or via get_query_var() before some other part of the code has initialized it.
This happens especially when we are testing a plugin and it uses $wp_query in its initialization routine.
Attachments (2)
Change History (6)
#2
@
12 years ago
- Owner set to nbachiyski
- Resolution set to fixed
- Status changed from new to closed
In 26996:
#3
@
12 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
The $wp->init() call in line 334 (wp-settings.php) should be transformed to $GLOBALS['wp']->init(). Otherwise unit tests that don't call global $wp; on their config file fail with a PHP fatal error due to the fact that $wp isn't defined.
Note: See
TracTickets for help on using
tickets.
Looks good.