From: Alexia E. Smith Date: Thu, 15 Mar 2018 15:24:21 +0000 (-0500) Subject: Fix User::idFromName() ignoring cache for non-existent users. X-Git-Tag: 1.31.0-rc.0~367^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=33e0a539b8b90ec8a667fda1ae31d1103b0ba460;p=lhc%2Fweb%2Fwiklou.git Fix User::idFromName() ignoring cache for non-existent users. This fixes a database time out issue where User::idFromName() is repeatedly called from Special:Import due to the user not existing. The response is cached as null, but isset() will return false on a null key. Bug: T189786 Change-Id: I78705089a25dfec84d3c75bedaf623b1e5ee82c4 --- diff --git a/includes/user/User.php b/includes/user/User.php index ab791b4caa..d6523a7f3c 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -885,7 +885,7 @@ class User implements IDBAccessObject, UserIdentity { return null; } - if ( !( $flags & self::READ_LATEST ) && isset( self::$idCacheByName[$name] ) ) { + if ( !( $flags & self::READ_LATEST ) && array_key_exists( $name, self::$idCacheByName ) ) { return self::$idCacheByName[$name]; }