Page MenuHomePhabricator

AbstractBlock::getHideName() can return 0/1 instead of boolean
Closed, ResolvedPublic

Description

Documentation for AbstractBlock::getHideName() claims it can return just a boolean. However, when writing https://gerrit.wikimedia.org/r/c/mediawiki/core/+/588104, I get a lot of errors like "0 is not false" or "1 is not true", meaning somehow unexpected values sneak in.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 25 2020, 11:12 PM

Apparently not specific to that method:

urbanecm@notebook (master * u=) ~/unsynced/gerrit/mediawiki/core
$ !php
php maintenance/shell.php --wiki=awiki
Psy Shell v0.9.12 (PHP 7.2.24-0ubuntu0.18.04.3 — cli) by Justin Hileman
>>> use MediaWiki\Block\DatabaseBlock;
>>> $block = DatabaseBlock::newFromTarget('127.0.0.3');
=> MediaWiki\Block\DatabaseBlock {#2557
     +mAuto: false,
     +mParentBlockId: 0,
     +mTimestamp: "20200328145821",
     +mExpiry: "infinity",
     +mHideName: false,
   }
>>>  $block->isCreateAccountBlocked();
=> "1"
Urbanecm claimed this task.Apr 26 2020, 5:53 PM
Restricted Application added a project: User-Urbanecm. · View Herald TranscriptApr 26 2020, 5:53 PM

Change 592491 had a related patch set uploaded (by Urbanecm; owner: Urbanecm):
[mediawiki/core@master] DatabaseBlock's status variables don't return bool

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

Urbanecm triaged this task as Low priority.Apr 26 2020, 6:15 PM
Urbanecm moved this task from Backlog to Waiting on review on the User-Urbanecm board.

Change 592491 merged by jenkins-bot:
[mediawiki/core@master] DatabaseBlock's status variables should return bool

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

Urbanecm closed this task as Resolved.Apr 29 2020, 9:20 AM