Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/66760
Description
get_site()can returnnull(for example, in customsunrise.phpsetups where the current site is not yet defined onwp-login.php). Several core call sites access properties directly on the return value ofget_site()without checking fornull, emitting PHP warnings.Changes
src/wp-includes/class-wp-network.php: Check$sitebefore reading$site->domainand$site->pathinWP_Network::get_main_site_id().src/wp-includes/ms-load.php: Returntrueearly inms_site_check()whenget_site()returnsnull.src/wp-includes/general-template.php: Check$blog_detailsbefore reading$blog_details->pathinwp_lostpassword_url().src/wp-admin/menu.php: Checkget_site()before reading->deletedwhen registering the Tools → Delete Site submenu item.src/wp-includes/class-wp-xmlrpc-server.php: Guard$current_blog->domainand$current_blog->pathinwp_xmlrpc_server::_multisite_getUsersBlogs().src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: Passget_current_blog_id()instead ofget_site()->idtoadd_user_to_blog().tests/phpunit/tests/multisite/getMainSiteId.phptests/phpunit/tests/general/wpLoginScreenUrls.phptests/phpunit/tests/multisite/msSiteCheck.phpTesting
vendor/bin/phpcs— 0 errors / 0 warnings on all changed linesvendor/bin/phpunit -c tests/phpunit/multisite.xml tests/phpunit/tests/multisite/getMainSiteId.php— OK (11 tests, 14 assertions)vendor/bin/phpunit -c tests/phpunit/multisite.xml tests/phpunit/tests/general/wpLoginScreenUrls.php— OK (10 tests, 16 assertions)vendor/bin/phpunit -c tests/phpunit/multisite.xml tests/phpunit/tests/multisite/msSiteCheck.php— OK (1 test, 1 assertion)vendor/bin/phpunit tests/phpunit/tests/general/wpLoginScreenUrls.php— OK (8 tests, 14 assertions)