From 754939bce0441b1c759efbf574c1cdc2b2478696 Mon Sep 17 00:00:00 2001
From: Bohdan Korablov <bkorablov@magento.com>
Date: Thu, 20 Oct 2016 14:28:24 +0300
Subject: [PATCH] MAGETWO-56317: [GitHub] -[2.1.0] underscore in site url
 breaks admin redirect - The page isn't redirecting properly #5809

---
 .../InstallStoreConfigurationCommand.php      | 50 ++++---------------
 1 file changed, 10 insertions(+), 40 deletions(-)

diff --git a/setup/src/Magento/Setup/Console/Command/InstallStoreConfigurationCommand.php b/setup/src/Magento/Setup/Console/Command/InstallStoreConfigurationCommand.php
index e1593d4e36a..f1098af2db0 100644
--- a/setup/src/Magento/Setup/Console/Command/InstallStoreConfigurationCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/InstallStoreConfigurationCommand.php
@@ -205,6 +205,7 @@ class InstallStoreConfigurationCommand extends AbstractSetupCommand
     public function validate(InputInterface $input)
     {
         $errors = [];
+        $errorMsg = '';
         $options = $input->getOptions();
         foreach ($options as $key => $value) {
             if (!$value) {
@@ -220,9 +221,7 @@ class InstallStoreConfigurationCommand extends AbstractSetupCommand
                         StoreConfigurationDataMapper::KEY_BASE_URL,
                         ['http', 'https']
                     );
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
+
                     break;
                 case StoreConfigurationDataMapper::KEY_LANGUAGE:
                     $errorMsg = $this->validateCodes(
@@ -230,9 +229,6 @@ class InstallStoreConfigurationCommand extends AbstractSetupCommand
                         $value,
                         StoreConfigurationDataMapper::KEY_LANGUAGE
                     );
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
                 case StoreConfigurationDataMapper::KEY_TIMEZONE:
                     $errorMsg = $this->validateCodes(
@@ -240,9 +236,6 @@ class InstallStoreConfigurationCommand extends AbstractSetupCommand
                         $value,
                         StoreConfigurationDataMapper::KEY_TIMEZONE
                     );
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
                 case StoreConfigurationDataMapper::KEY_CURRENCY:
                     $errorMsg = $this->validateCodes(
@@ -250,62 +243,39 @@ class InstallStoreConfigurationCommand extends AbstractSetupCommand
                         $value,
                         StoreConfigurationDataMapper::KEY_CURRENCY
                     );
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
                 case StoreConfigurationDataMapper::KEY_USE_SEF_URL:
                     $errorMsg = $this->validateBinaryValue($value, StoreConfigurationDataMapper::KEY_USE_SEF_URL);
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
                 case StoreConfigurationDataMapper::KEY_IS_SECURE:
                     $errorMsg = $this->validateBinaryValue($value, StoreConfigurationDataMapper::KEY_IS_SECURE);
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
                 case StoreConfigurationDataMapper::KEY_BASE_URL_SECURE:
-                    try {
-                        $errorMsg = $this->validateUrl(
-                            $value,
-                            StoreConfigurationDataMapper::KEY_BASE_URL_SECURE,
-                            ['https']
-                        );
-                        if ($errorMsg !== '') {
-                            $errors[] = $errorMsg;
-                        }
-                    } catch (LocalizedException $e) {
-                        $errors[] = '<error>' . 'Command option \'' . StoreConfigurationDataMapper::KEY_BASE_URL_SECURE
-                            . '\': ' . $e->getLogMessage() .'</error>';
-                    }
+                    $errorMsg = $this->validateUrl(
+                        $value,
+                        StoreConfigurationDataMapper::KEY_BASE_URL_SECURE,
+                        ['https']
+                    );
                     break;
                 case StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN:
                     $errorMsg = $this->validateBinaryValue($value, StoreConfigurationDataMapper::KEY_IS_SECURE_ADMIN);
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
                 case StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY:
                     $errorMsg = $this->validateBinaryValue(
                         $value,
                         StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY
                     );
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
                 case StoreConfigurationDataMapper::KEY_JS_LOGGING:
                     $errorMsg = $this->validateBinaryValue(
                         $value,
                         StoreConfigurationDataMapper::KEY_JS_LOGGING
                     );
-                    if ($errorMsg !== '') {
-                        $errors[] = $errorMsg;
-                    }
                     break;
             }
+            if ($errorMsg !== '') {
+                $errors[] = $errorMsg;
+            }
         }
         return $errors;
     }
-- 
GitLab