From a50014d259ff9f045ed4ae2ae56ed9e211b85ba1 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Mon, 3 Dec 2018 14:33:48 +0100 Subject: [PATCH] Fix unexpected return type of User::idFromName() The user_id is an unsigned integer in the database. But not all database abstractions we use are guaranteed to return integer values as PHP integers. Sometimes it's a string and needs an integer cast first. Want proof? Search for usages of this method. Almost all add an (int) cast. This is weird and should not be necessary. Change-Id: If1d706f73350fca5b3a0f1e0de59e4518162445b --- includes/user/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/user/User.php b/includes/user/User.php index 0bea7e3cce..bf848333d0 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -935,7 +935,7 @@ class User implements IDBAccessObject, UserIdentity { if ( $s === false ) { $result = null; } else { - $result = $s->user_id; + $result = (int)$s->user_id; } self::$idCacheByName[$name] = $result; -- 2.20.1