jenkins-bot has submitted this change and it was merged.

Change subject: Check for empty alias after trimming in SpecialNewEntity
......................................................................


Check for empty alias after trimming in SpecialNewEntity

Follow-up for I7ff02db.

Bug: T130459
Change-Id: I5736942b79106800e9e11ed68966e83959d43903
---
M repo/includes/Specials/SpecialNewEntity.php
1 file changed, 13 insertions(+), 9 deletions(-)

Approvals:
  Hoo man: Looks good to me, approved
  D3r1ck01: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/repo/includes/Specials/SpecialNewEntity.php 
b/repo/includes/Specials/SpecialNewEntity.php
index 83654d7..ab33917 100644
--- a/repo/includes/Specials/SpecialNewEntity.php
+++ b/repo/includes/Specials/SpecialNewEntity.php
@@ -36,17 +36,17 @@
        /**
         * @var string|null
         */
-       private $label = null;
+       private $label;
 
        /**
         * @var string|null
         */
-       private $description = null;
+       private $description;
 
        /**
-        * @var Language
+        * @var Language|null
         */
-       private $contentLanguage = null;
+       private $contentLanguage;
 
        /**
         * @var string[]
@@ -66,7 +66,7 @@
        /**
         * @var string[]
         */
-       private $aliases;
+       private $aliases = array();
 
        /**
         * @param string $name Name of the special page, as seen in links and 
URLs.
@@ -182,12 +182,15 @@
                $this->description = $this->stringNormalizer->trimToNFC( 
$description );
 
                $aliases = $this->getRequest()->getVal( 'aliases' );
-               $explodedAliases = ( $aliases === null ? array() : explode( 
'|', $aliases ) );
+               $explodedAliases = $aliases === null ? array() : explode( '|', 
$aliases );
                foreach ( $explodedAliases as $alias ) {
+                       $alias = $this->stringNormalizer->trimToNFC( $alias );
+
                        if ( $alias !== '' ) {
-                               $this->aliases[] = 
$this->stringNormalizer->trimToNFC( $alias );
+                               $this->aliases[] = $alias;
                        }
                }
+
                $this->contentLanguage = Language::factory( 
$this->getRequest()->getVal(
                        'lang',
                        $this->getLanguage()->getCode()
@@ -202,8 +205,9 @@
         * @return bool
         */
        protected function hasSufficientArguments() {
-               return $this->label !== '' || $this->description !== ''
-               || implode( '', $this->aliases ) !== '';
+               return $this->label !== ''
+                       || $this->description !== ''
+                       || $this->aliases !== array();
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/278867
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5736942b79106800e9e11ed68966e83959d43903
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to