From: Happy-melon Date: Sat, 19 Sep 2009 12:46:51 +0000 (+0000) Subject: Fix User::idFromName to actually return null on failure, as the doc suggests. X-Git-Tag: 1.31.0-rc.0~39630 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=362d93fea0b3d225dbc47cd1510aa0b1e82e8abd;p=lhc%2Fweb%2Fwiklou.git Fix User::idFromName to actually return null on failure, as the doc suggests. --- diff --git a/includes/User.php b/includes/User.php index 995e6c153c..1f79998cb0 100644 --- a/includes/User.php +++ b/includes/User.php @@ -467,7 +467,7 @@ class User { $s = $dbr->selectRow( 'user', array( 'user_id' ), array( 'user_name' => $nt->getText() ), __METHOD__ ); if ( $s === false ) { - $result = 0; + $result = null; } else { $result = $s->user_id; } @@ -2151,7 +2151,7 @@ class User { } # Use strict parameter to avoid matching numeric 0 accidentally inserted # by misconfiguration: 0 == 'foo' - return in_array( $action, $this->getRights(), true ); + return in_array( $action, $this->getRights(), true ) } /**