From 1e19b521b1d3a205f695fe48e9b5bdbd047fdf1a Mon Sep 17 00:00:00 2001 From: Alex Dong Date: Thu, 10 Nov 2022 15:47:39 +0700 Subject: [PATCH] Compatible PHP8.x --- Controller/Adminhtml/Action.php | 4 ++-- Controller/Adminhtml/Index/Save.php | 2 +- Helper/Data.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Controller/Adminhtml/Action.php b/Controller/Adminhtml/Action.php index 100e489..f66a744 100644 --- a/Controller/Adminhtml/Action.php +++ b/Controller/Adminhtml/Action.php @@ -95,8 +95,8 @@ public function __construct( protected function _isAllowed() { $namespace = (new \ReflectionObject($this))->getNamespaceName(); - $string = strtolower(str_replace(__NAMESPACE__ . '\\','', $namespace)); - $action = explode('\\', $string); + $string = strtolower(str_replace(__NAMESPACE__ . '\\','', (string) $namespace)); + $action = explode('\\', (string) $string); $action = array_shift($action); return $this->_authorization->isAllowed("Magiccart_Magicslider::magicslider_$action"); } diff --git a/Controller/Adminhtml/Index/Save.php b/Controller/Adminhtml/Index/Save.php index b998905..4e476b4 100644 --- a/Controller/Adminhtml/Index/Save.php +++ b/Controller/Adminhtml/Index/Save.php @@ -127,7 +127,7 @@ public function execute() } unset($images[$key]); } else { - if(!preg_match ( '/^\/mobile\/*/', $image['file'])){ + if(!preg_match ( '/^\/mobile\/*/', (string) $image['file'])){ $images[$key]['file']= '/mobile' . $image['file']; } diff --git a/Helper/Data.php b/Helper/Data.php index 278c9d7..620c38b 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -32,7 +32,7 @@ public function __construct( { parent::__construct($context); $this->moduleManager = $moduleManager; - $module = strtolower(str_replace('Magiccart_', '', $this->_getModuleName())); + $module = strtolower(str_replace('Magiccart_', '', (string) $this->_getModuleName())); $this->configModule = $this->getConfig($module); } @@ -47,7 +47,7 @@ public function getConfigModule($cfg='', $value=null) { $values = $this->configModule; if( !$cfg ) return $values; - $config = explode('/', $cfg); + $config = explode('/', (string) $cfg); $end = count($config) - 1; foreach ($config as $key => $vl) { if( isset($values[$vl]) ){