r64862 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64861‎ | r64862 | r64863 >
Date:11:10, 10 April 2010
Author:catrope
Status:ok (Comments)
Tags:
Comment:
Fix epic fail in r64860
Modified paths:
  • /trunk/phase3/includes/specials/SpecialEmailuser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialEmailuser.php
@@ -303,7 +303,7 @@
304304 }
305305
306306 $nu = User::newFromName( $nt->getText() );
307 - if( !$nu instanceof Title || !$nu->getId() ) {
 307+ if( !$nu instanceof User || !$nu->getId() ) {
308308 wfDebug( "Target is invalid user.\n" );
309309 return "notarget";
310310 } else if ( !$nu->isEmailConfirmed() ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r64863i1.16wmf4: MFT r64862catrope11:12, 10 April 2010
r65360MFT r63490, r64837, r64860, r64862: bug fixes for callers of User::newFromNam...tstarling09:30, 21 April 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64860Fix yet another instance of comparing the result of User::newFromName to nullcatrope10:08, 10 April 2010

Comments

#Comment by 😂 (talk | contribs)   13:22, 20 April 2010

Shouldn't this be !($nu instanceof User) instead of !$nu instanceof User?

#Comment by Catrope (talk | contribs)   13:24, 20 April 2010

Fortunately, instanceof takes precedence over ! in PHP. In languages like Java and JavaScript, this is the other way around and you would need parentheses.

#Comment by Tim Starling (talk | contribs)   08:39, 27 July 2010

I'm not sure why this is marked for 1.15 backport. It's not necessary to backport this or any related change to 1.15 since User::newFromName() did in fact return null until r58025, which was well after the branch point.

#Comment by Bryan (talk | contribs)   10:16, 27 July 2010

My mistake.

Status & tagging log