If partial blocks are available but a sitewide block is being made,
$params['pagerestrictions'] is null and implode() raises a warning.
Since null casts to the empty array, it's easy enough to work around.
Also add a test hitting this case.
Change-Id: Id7e2559d7569031b7c1228adb0c0a14b3c1527c3
$editingRestriction = 'partial';
}
- $pageRestrictions = implode( "\n", $params['pagerestrictions'] );
+ $pageRestrictions = implode( "\n", (array)$params['pagerestrictions'] );
}
if ( $params['userid'] !== null ) {
$this->doBlock( [ 'expiry' => '' ] );
}
+ public function testBlockWithoutRestrictions() {
+ $this->setMwGlobals( [
+ 'wgEnablePartialBlocks' => true,
+ ] );
+
+ $this->doBlock();
+
+ $block = Block::newFromTarget( $this->mUser->getName() );
+
+ $this->assertTrue( $block->isSitewide() );
+ $this->assertCount( 0, $block->getRestrictions() );
+ }
+
public function testBlockWithRestrictions() {
$this->setMwGlobals( [
'wgEnablePartialBlocks' => true,