Page MenuHomePhabricator

Fatal error: Call to a member function getPrefixedText() on a non-object at SpecialGlobalBlock.php on line 278
Closed, ResolvedPublic

Description

[13:19:51] <matanya> this one was ipv6 address
[13:20:20] <matanya> Reedy: 2A02:2498:E003:68:225:90FF:FE88:4840 if to be specific

[24-Dec-2013 12:55:46] Fatal error: Call to a member function getPrefixedText() on a non-object at /usr/local/apache/common-local/php-1.23wmf7/extensions/GlobalBlocking/SpecialGlobalBlock.php on line 278
Server: mw1057
Method: POST
URL: http://meta.wikimedia.org/wiki/Special:GlobalBlock
Backtrace:
#0 /usr/local/apache/common-local/php-1.23wmf7/extensions/GlobalBlocking/SpecialGlobalBlock.php(278): SpecialGlobalBlock::form()
#1 /usr/local/apache/common-local/php-1.23wmf7/extensions/GlobalBlocking/SpecialGlobalBlock.php(69): SpecialGlobalBlock->form('<div class="err...')
#2 /usr/local/apache/common-local/php-1.23wmf7/includes/specialpage/SpecialPage.php(673): SpecialGlobalBlock->execute(NULL)
#3 /usr/local/apache/common-local/php-1.23wmf7/includes/SpecialPageFactory.php(488): SpecialPage->run(NULL)
#4 /usr/local/apache/common-local/php-1.23wmf7/includes/Wiki.php(298): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#5 /usr/local/apache/common-local/php-1.23wmf7/includes/Wiki.php(596): MediaWiki->performRequest()
#6 /usr/local/apache/common-local/php-1.23wmf7/includes/Wiki.php(460): MediaWiki->main()
#7 /usr/local/apache/common-local/php-1.23wmf7/index.php(49): MediaWiki->run()
#8 /usr/local/apache/common-local/w/index.php(3): require('/usr/local/apac...')
#9 {main}

Version: master
Severity: normal

Details

Reference
bz58934

Event Timeline

bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz58934.
bzimport added a subscriber: Unknown Object (MLST).
Reedy created this task.Dec 24 2013, 1:25 PM

Change 103542 had a related patch set uploaded by Reedy:
Title::makeTitleSafe can return null

https://gerrit.wikimedia.org/r/103542

Change 103542 merged by jenkins-bot:
Title::makeTitleSafe can return null

https://gerrit.wikimedia.org/r/103542

Reedy added a comment.EditedDec 24 2013, 1:34 PM
reedy@tin:~$ mwscript eval.php metawiki
> $title = Title::makeTitleSafe( NS_USER, 2A02:2498:E003:68:225:90FF:FE88:4840' );

> var_dump( $title );
object(Title)#64 (28) {
  ["mTextform"]=>
  string(36) "2A02:2498:E003:68:225:90FF:FE88:4840"
  ["mUrlform"]=>
  string(36) "2A02:2498:E003:68:225:90FF:FE88:4840"
  ["mDbkeyform"]=>
  string(36) "2A02:2498:E003:68:225:90FF:FE88:4840"
  ["mUserCaseDBKey"]=>
  string(36) "2A02:2498:E003:68:225:90FF:FE88:4840"
  ["mNamespace"]=>
  int(2)
  ["mInterwiki"]=>
  string(0) ""
  ["mFragment"]=>
  string(0) ""
  ["mArticleID"]=>
  int(-1)
  ["mLatestID"]=>
  bool(false)
  ["mContentModel"]=>
  bool(false)
  ["mEstimateRevisions":"Title":private]=>
  NULL
  ["mRestrictions"]=>
  array(0) {
  }
  ["mOldRestrictions"]=>
  bool(false)
  ["mCascadeRestriction"]=>
  NULL
  ["mCascadingRestrictions"]=>
  NULL
  ["mRestrictionsExpiry"]=>
  array(0) {
  }
  ["mHasCascadingRestrictions"]=>
  NULL
  ["mCascadeSources"]=>
  NULL
  ["mRestrictionsLoaded"]=>
  bool(false)
  ["mPrefixedText"]=>
  NULL
  ["mTitleProtection"]=>
  NULL
  ["mDefaultNamespace"]=>
  int(0)
  ["mWatched"]=>
  NULL
  ["mLength"]=>
  int(-1)
  ["mRedirect"]=>
  NULL
  ["mNotificationTimestamp"]=>
  array(0) {
  }
  ["mHasSubpage"]=>
  NULL
  ["mPageLanguage":"Title":private]=>
  bool(false)
}
Reedy added a comment.Dec 24 2013, 1:40 PM

[13:34:55] <matanya> The IP address (2A02:2498:E003:68:225:90FF:FE88:4840) you entered is invalid. Please note that you cannot enter a user name!

'globalblocking-block-ipinvalid' => 'The IP address ($1) you entered is invalid.
Please note that you cannot enter a user name!',

		$ip = IP::sanitizeIP( $address );

...

		if ( !IP::isIPAddress( $ip ) ) {
			// Invalid IP address.
			$errors[] = array( 'globalblocking-block-ipinvalid', $ip );
		}

reedy@tin:/a/common$ mwscript eval.php metawiki

$ip = '2A02:2498:E003:68:225:90FF:FE88:4840';

$ip = IP::sanitizeIP( $ip );

var_dump( $ip, IP::isIPAddress( $ip ) );

string(36) "2A02:2498:E003:68:225:90FF:FE88:4840"
bool(true)

Reedy: Is this fixed by your patch, or is more work needed?

Change 105889 had a related patch set uploaded by Tim Starling:
Title::makeTitleSafe can return null

https://gerrit.wikimedia.org/r/105889

Change 105889 merged by jenkins-bot:
Title::makeTitleSafe can return null

https://gerrit.wikimedia.org/r/105889

Only the fatal is fixed, Tim wrote that it "might warrant further investigation later", so remarking as NEW

Change 107018 had a related patch set uploaded by Legoktm:
Validate $this->mAddress before storing it

https://gerrit.wikimedia.org/r/107018

I reproduced it locally by entering an invalid username ("<><") and then submitting the form.

I'm not sure why the IP address in comment 0 is failing, maybe the post data got corrupted while being sent to the server? Either way, this should fix the fatal.

Patch has a -1 and needs rework

demon set Security to None.
demon raised the priority of this task from Normal to High.Oct 26 2015, 5:28 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 26 2015, 5:28 PM

Any reason why was the priority was raised? The fatal shouldn't be thrown since Reedy's patch and it doesn't look like the second patch is something we want to do here.

Reedy updated the task description. (Show Details)Oct 27 2015, 12:07 PM

Change 107018 abandoned by Chad:
Validate $this->mAddress before storing it

Reason:
This doesn't really fix anything and nobody's cared enough to follow up for like a year and a half.

https://gerrit.wikimedia.org/r/107018

demon closed this task as Resolved.Dec 3 2015, 7:10 PM
demon claimed this task.
demon added subscribers: duplicatebug, demon.

Only the fatal is fixed, Tim wrote that it "might warrant further investigation later", so remarking as NEW

I don't think this needs any further investigation. Not all that interesting of a bug and the error is easily avoided now.