r59761 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59760‎ | r59761 | r59762 >
Date:21:26, 5 December 2009
Author:ialex
Status:ok (Comments)
Tags:
Comment:
User::newFromName() can return false on invalid user name, and thus was throwing "PHP Fatal error: Call to a member function idForName() on a non-object in includes/specials/SpecialUserlogin.php on line 280"
Modified paths:
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -272,7 +272,7 @@
273273 return false;
274274 }
275275
276 - if ( is_null( $u ) ) {
 276+ if ( is_null( $u ) || $u === false ) {
277277 $this->mainLoginForm( wfMsg( 'noname' ) );
278278 return false;
279279 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r59797Per Nikerabbit, follow-up to r59761: just check for "instanceof User"ialex19:42, 7 December 2009
r59893Fix r59761,r59797: check if is_object()demon18:25, 9 December 2009

Comments

#Comment by Nikerabbit (talk | contribs)   23:33, 5 December 2009

Could it be just if ( $u ) or if ( $u instance of User )?

#Comment by IAlex (talk | contribs)   19:43, 7 December 2009

Done in r59797.

#Comment by Tim Starling (talk | contribs)   23:24, 8 December 2009

The problem with that is that it breaks StubUser and any other similar proxy objects. My vote would be for is_object().

Status & tagging log