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

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"

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

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