Coding Standards: Replace redundant check in wpmu_validate_blog_signup().
Some checks failed
Cleanup Pull Requests / Clean up pull requests (push) Has been cancelled
Coding Standards / PHP coding standards (push) Has been cancelled
Coding Standards / JavaScript coding standards (push) Has been cancelled
Coding Standards / Slack Notifications (push) Has been cancelled
Coding Standards / Failed workflow tasks (push) Has been cancelled
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Has been cancelled
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Has been cancelled
End-to-end Tests / Slack Notifications (push) Has been cancelled
End-to-end Tests / Failed workflow tasks (push) Has been cancelled
JavaScript Tests / QUnit Tests (push) Has been cancelled
JavaScript Tests / Slack Notifications (push) Has been cancelled
JavaScript Tests / Failed workflow tasks (push) Has been cancelled
Performance Tests / Determine Matrix (push) Has been cancelled
Performance Tests / ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} (push) Has been cancelled
Performance Tests / Compare (push) Has been cancelled
Performance Tests / Slack Notifications (push) Has been cancelled
Performance Tests / Failed workflow tasks (push) Has been cancelled
PHP Compatibility / Check PHP compatibility (push) Has been cancelled
PHP Compatibility / Slack Notifications (push) Has been cancelled
PHP Compatibility / Failed workflow tasks (push) Has been cancelled
PHPUnit Tests / PHP 7.2 (push) Has been cancelled
PHPUnit Tests / PHP 7.3 (push) Has been cancelled
PHPUnit Tests / PHP 7.4 (push) Has been cancelled
PHPUnit Tests / PHP 8.0 (push) Has been cancelled
PHPUnit Tests / PHP 8.1 (push) Has been cancelled
PHPUnit Tests / PHP 8.2 (push) Has been cancelled
PHPUnit Tests / PHP 8.3 (push) Has been cancelled
PHPUnit Tests / PHP 8.4 (push) Has been cancelled
PHPUnit Tests / html-api-html5lib-tests (push) Has been cancelled
PHPUnit Tests / Slack Notifications (push) Has been cancelled
PHPUnit Tests / Failed workflow tasks (push) Has been cancelled
Test Build Processes / Core running from build (push) Has been cancelled
Test Build Processes / Core running from src (push) Has been cancelled
Test Build Processes / Gutenberg running from build (push) Has been cancelled
Test Build Processes / Gutenberg running from src (push) Has been cancelled
Test Build Processes / Slack Notifications (push) Has been cancelled
Test Build Processes / Failed workflow tasks (push) Has been cancelled
Upgrade Develop Version Tests / Build (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 4.9 (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 6.6 (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 6.7 (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 6.8 (push) Has been cancelled
Upgrade Develop Version Tests / Slack Notifications (push) Has been cancelled
Upgrade Develop Version Tests / Failed workflow tasks (push) Has been cancelled
Code Coverage Report / Single site report (push) Has been cancelled
Code Coverage Report / Multisite report (push) Has been cancelled
Code Coverage Report / Slack Notifications (push) Has been cancelled
Code Coverage Report / Failed workflow tasks (push) Has been cancelled
Installation Tests / Build Test Matrix (push) Has been cancelled
Installation Tests / WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }} (push) Has been cancelled
Installation Tests / Slack Notifications (push) Has been cancelled
Installation Tests / Failed workflow tasks (push) Has been cancelled

The `is_object()` check would always be true in the second part of the conditional. This commit adds an `instanceof WP_User` check instead before accessing the `user_login` property.

Follow-up to [41963], [https://mu.trac.wordpress.org/changeset/550 mu:550], [https://mu.trac.wordpress.org/changeset/1958 mu:1958], [12603].

Props justlevine.
See #63268.

git-svn-id: https://develop.svn.wordpress.org/trunk@60450 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2025-07-13 15:20:49 +00:00
parent 0fd771abdb
commit 9032503ef1

View File

@@ -730,7 +730,7 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
* unless it's the user's own username.
*/
if ( username_exists( $blogname ) ) {
if ( ! is_object( $user ) || ( is_object( $user ) && $user->user_login !== $blogname ) ) {
if ( ! $user instanceof WP_User || $user->user_login !== $blogname ) {
$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
}
}