If $name is a User object, some code magically works because the object
gets converted to a string, but other code blows up because objects
aren't valid array keys. Prevent this from happening by explicitly
forcing $name to be a string.
Bug: T208469
Change-Id: Icc9ebec93d18609605e2633ccd23b90478e05e51
* @return int|null The corresponding user's ID, or null if user is nonexistent
*/
public static function idFromName( $name, $flags = self::READ_NORMAL ) {
+ // Don't explode on self::$idCacheByName[$name] if $name is not a string but e.g. a User object
+ $name = (string)$name;
$nt = Title::makeTitleSafe( NS_USER, $name );
if ( is_null( $nt ) ) {
// Illegal name