id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 29930 Polluted globals break Tests_Option_BlogOption jeremyfelt jeremyfelt "In current trunk, I get two failed tests related to multisite: {{{ 1) Tests_Option_BlogOption::test_from_same_site Failed asserting that false is true. /srv/www/wordpress-develop/tests/phpunit/tests/option/blogOption.php:33 2) Tests_Option_BlogOption::test_from_same_site_with_null_blog_id Failed asserting that false is true. /srv/www/wordpress-develop/tests/phpunit/tests/option/blogOption.php:70 }}} In both cases, even though `get_current_blog_id()` returns 1, and `_wp_switched_stack` is empty, the `$wpdb` global is polluted with old information due to our use of `_setup_host_request()` when testing the multisite bootstrap. Each of these loads the entire multisite bootstrap as the requested domain. This creates an environment where the blog ID changes (to say 75), but it does not appear to be a switched environment. When the teardown tasks run, we `restore_current_blog()` only if we see that it's switched. The attached past makes one final `_setup_host_request()` to the `WP_TESTS_DOMAIN` after running through all other bootstrap tests. This causes `ms-settings.php` to setup the global stack as if it was the initial request. Tests then pass. Related: #27884" defect (bug) closed normal 4.1 Networks and Sites normal fixed has-patch multisite