From: Thiemo Kreuz Date: Mon, 3 Dec 2018 13:33:48 +0000 (+0100) Subject: Fix unexpected return type of User::idFromName() X-Git-Tag: 1.34.0-rc.0~3354^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=commitdiff_plain;h=a50014d259ff9f045ed4ae2ae56ed9e211b85ba1;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;