Page MenuHomePhabricator

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


Documentation for AbstractBlock::getHideName() claims it can return just a boolean. However, when writing, 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('');
=> 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

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

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