Make sure page restrictions are handled as a string
authorThalia <thalia.e.chan@googlemail.com>
Fri, 18 Jan 2019 16:22:09 +0000 (16:22 +0000)
committerThalia <thalia.e.chan@googlemail.com>
Fri, 18 Jan 2019 16:22:09 +0000 (16:22 +0000)
Bug: T214173
Change-Id: I3ec9b0a4f797b0e89fd30a9ceafcaaf8a6dce5d9

includes/specials/SpecialBlock.php

index e47ef06..a482720 100644 (file)
@@ -841,7 +841,7 @@ class SpecialBlock extends FormSpecialPage {
 
                $restrictions = [];
                if ( $enablePartialBlocks ) {
 
                $restrictions = [];
                if ( $enablePartialBlocks ) {
-                       if ( !empty( $data['PageRestrictions'] ) ) {
+                       if ( $data['PageRestrictions'] !== '' ) {
                                $restrictions = array_map( function ( $text ) {
                                        $title = Title::newFromText( $text );
                                        // Use the link cache since the title has already been loaded when
                                $restrictions = array_map( function ( $text ) {
                                        $title = Title::newFromText( $text );
                                        // Use the link cache since the title has already been loaded when
@@ -952,7 +952,7 @@ class SpecialBlock extends FormSpecialPage {
                $logParams['6::flags'] = self::blockLogFlags( $data, $type );
                $logParams['sitewide'] = $block->isSitewide();
 
                $logParams['6::flags'] = self::blockLogFlags( $data, $type );
                $logParams['sitewide'] = $block->isSitewide();
 
-               if ( $enablePartialBlocks && !empty( $data['PageRestrictions'] ) ) {
+               if ( $enablePartialBlocks && $data['PageRestrictions'] !== '' ) {
                        $logParams['7::restrictions'] = [
                                'pages' => explode( "\n", $data['PageRestrictions'] ),
                        ];
                        $logParams['7::restrictions'] = [
                                'pages' => explode( "\n", $data['PageRestrictions'] ),
                        ];
@@ -1166,7 +1166,7 @@ class SpecialBlock extends FormSpecialPage {
                // actions other than editing, and there must be no restrictions.
                if ( isset( $data['Editing'] ) && $data['Editing'] === false ) {
                        $data['EditingRestriction'] = 'partial';
                // actions other than editing, and there must be no restrictions.
                if ( isset( $data['Editing'] ) && $data['Editing'] === false ) {
                        $data['EditingRestriction'] = 'partial';
-                       $data['PageRestrictions'] = [];
+                       $data['PageRestrictions'] = '';
                }
                return self::processForm( $data, $form->getContext() );
        }
                }
                return self::processForm( $data, $form->getContext() );
        }