From 767da58f655cc37a5e40ea7013fa612fa90d906c Mon Sep 17 00:00:00 2001 From: Manu Gonzalez Date: Sun, 5 Nov 2017 13:37:11 +0100 Subject: [PATCH] modifier i (PCRE_CASELESS) and Website _beforeSave() --- app/code/Magento/Store/Model/ResourceModel/Website.php | 4 ++-- app/code/Magento/Store/Model/Store.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Store/Model/ResourceModel/Website.php b/app/code/Magento/Store/Model/ResourceModel/Website.php index bed38f2651c1a..bf15b6b851e3a 100644 --- a/app/code/Magento/Store/Model/ResourceModel/Website.php +++ b/app/code/Magento/Store/Model/ResourceModel/Website.php @@ -47,7 +47,7 @@ public function readAllWebsites() ->select() ->from($this->getTable('store_website')); - foreach($this->getConnection()->fetchAll($select) as $websiteData) { + foreach ($this->getConnection()->fetchAll($select) as $websiteData) { $websites[$websiteData['code']] = $websiteData; } @@ -63,7 +63,7 @@ public function readAllWebsites() */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) { - if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) { + if (!preg_match('/^[a-z]+[a-z0-9_]*$/i', $object->getCode())) { throw new \Magento\Framework\Exception\LocalizedException( __( 'Website code may only contain letters (a-z), numbers (0-9) or underscore (_),' diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 7aa723ab1231f..026d233cf060b 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -12,10 +12,10 @@ use Magento\Framework\App\Http\Context; use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ScopeInterface as AppScopeInterface; -use Magento\Framework\Filesystem; use Magento\Framework\DataObject\IdentityInterface; -use Magento\Framework\Url\ScopeInterface as UrlScopeInterface; +use Magento\Framework\Filesystem; use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Framework\Url\ScopeInterface as UrlScopeInterface; use Magento\Framework\UrlInterface; use Magento\Store\Api\Data\StoreInterface; @@ -459,7 +459,7 @@ protected function _getValidationRulesBeforeSave() $storeLabelRule->setMessage(__('Name is required'), \Zend_Validate_NotEmpty::IS_EMPTY); $validator->addRule($storeLabelRule, 'name'); - $storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/'); + $storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/i'); $storeCodeRule->setMessage( __( 'The store code may contain only letters (a-z), numbers (0-9) or underscore (_),'