WordPress fails to load if wp-load.php is not called from the global scope
|Reported by:||dave1010||Owned by:|
WordPress assumes it is being loaded in the global scope. Although including WordPress from inside a function is a strange (and probably should be an unsupported) thing to do, PHPUnit's commandline runner does it and there are probably other reasons someone may want to do it.
See this discussion as an example.
To fix this, wp-settings.php needs assumed globals to be specifically defined as globals. E.g.
// assumed global: $wp_the_query =& new WP_Query(); // changing to implied global: $GLOBALS['wp_the_query'] =& new WP_Query();
This shouldn't affect anything else (unless I'm missing something) and it also makes it clearer that the variables are global.
Might a patch get applied if I were to submit one?