Commit 7a2c67c454 for wordpress.org
commit 7a2c67c4542f610b592ea1799790b9357bb0a4fc
Author: Sergey Biryukov <sergeybiryukov.ru@gmail.com>
Date: Fri Apr 18 20:28:27 2025 +0000
Coding Standards: Correct `$site_id` parameter default values in `WP_User`.
This commit corrects the default `$site_id` parameter values used throughout the `WP_User` class to bring them in line with their `int` doctypes (and the doctypes of the functions used internally by the affected class methods).
More specifically,
* `__construct()`: `$site_id = ''` changed to `$site_id = 0`
* `init()`: `$site_id = ''` changed to `$site_id = 0`
* `for_blog()`: `$blog_id = ''` changed to `$blog_id = 0`
* `for_site()`: `$site_id = ''` changed to `$site_id = 0`
Follow-up to [12796], [15566], [18597], [41624].
Props justlevine.
See #63268.
Built from https://develop.svn.wordpress.org/trunk@60174
git-svn-id: http://core.svn.wordpress.org/trunk@59510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-user.php b/wp-includes/class-wp-user.php
index 2d7c20f9d3..8fd5e5cd21 100644
--- a/wp-includes/class-wp-user.php
+++ b/wp-includes/class-wp-user.php
@@ -125,7 +125,7 @@ class WP_User {
* @param string $name Optional. User's username
* @param int $site_id Optional Site ID, defaults to current site.
*/
- public function __construct( $id = 0, $name = '', $site_id = '' ) {
+ public function __construct( $id = 0, $name = '', $site_id = 0 ) {
global $wpdb;
if ( ! isset( self::$back_compat_keys ) ) {
@@ -175,7 +175,7 @@ class WP_User {
* @param object $data User DB row object.
* @param int $site_id Optional. The site ID to initialize for.
*/
- public function init( $data, $site_id = '' ) {
+ public function init( $data, $site_id = 0 ) {
if ( ! isset( $data->ID ) ) {
$data->ID = 0;
}
@@ -852,7 +852,7 @@ class WP_User {
*
* @param int $blog_id Optional. Site ID, defaults to current site.
*/
- public function for_blog( $blog_id = '' ) {
+ public function for_blog( $blog_id = 0 ) {
_deprecated_function( __METHOD__, '4.9.0', 'WP_User::for_site()' );
$this->for_site( $blog_id );
@@ -867,7 +867,7 @@ class WP_User {
*
* @param int $site_id Site ID to initialize user capabilities for. Default is the current site.
*/
- public function for_site( $site_id = '' ) {
+ public function for_site( $site_id = 0 ) {
global $wpdb;
if ( ! empty( $site_id ) ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index b97decea26..6a34c51942 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.9-alpha-60173';
+$wp_version = '6.9-alpha-60174';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.