r106450 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106449‎ | r106450 | r106451 >
Date:17:47, 16 December 2011
Author:rsterbin
Status:ok (Comments)
Tags:todo 
Comment:
Broke out missing user into its own error; fixes r106018
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
@@ -449,16 +449,18 @@
450450 $timestamp = $dbw->timestamp();
451451 $ip = null;
452452
 453+ if ( !$wgUser ) {
 454+ $this->dieUsage( 'User info is missing', 'missinguser' );
 455+ }
 456+
453457 // Only save IP address if the user isn't logged in.
454458 if ( !$wgUser->isLoggedIn() ) {
455459 $ip = wfGetIP();
456460 }
457461
458 - # make sure we have a page/user
459 - if ( !$params['pageid'] || !$wgUser) {
460 - if ( !$feedbackId ) {
461 - $this->dieUsage( 'Page ID is missing or invalid', 'invalidpageid' );
462 - }
 462+ // Make sure we have a page ID
 463+ if ( !$params['pageid'] ) {
 464+ $this->dieUsage( 'Page ID is missing or invalid', 'invalidpageid' );
463465 }
464466
465467 # Fetch this if it wasn't passed in
@@ -631,6 +633,7 @@
632634 array( 'code' => 'invalidtoken', 'info' => 'The anontoken is not 32 characters' ),
633635 array( 'code' => 'invalidpage', 'info' => 'ArticleFeedback is not enabled on this page' ),
634636 array( 'code' => 'invalidpageid', 'info' => 'Page ID is missing or invalid' ),
 637+ array( 'code' => 'missinguser', 'info' => 'User info is missing' ),
635638 ) );
636639 }
637640

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106018Fix for r105252: Not checking the result of Title::newFromID could cause a fa...rsterbin13:06, 13 December 2011

Comments

#Comment by Catrope (talk | contribs)   15:57, 19 December 2011
+		if ( !$wgUser ) {
+			$this->dieUsage( 'User info is missing', 'missinguser' );
+		}

I don't think a non-object $wgUser is supposed to be possible.

Status & tagging log