diff --git a/app/Mage.php b/app/Mage.php index 0c8564f9b7d..fea267e1fff 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -845,7 +845,7 @@ public static function isInstalled($options = []) if (is_readable($localConfigFile)) { $localConfig = simplexml_load_file($localConfigFile); date_default_timezone_set('UTC'); - if (($date = $localConfig->global->install->date) && strtotime($date)) { + if (($date = $localConfig->global->install->date) && strtotime((string)$date)) { self::$_isInstalled = true; } } diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php index 2db99e92c38..33de324c5b0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php @@ -84,6 +84,6 @@ public function getEscapedValue($index = null) return null; } - return number_format($value, 2, null, ''); + return number_format((float)$value, 2, null, ''); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php index eebb7e33318..be2618562fc 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Abstract.php @@ -142,7 +142,7 @@ public function renderProperty() if ($this->getColumn()->hasData('width')) { $customWidth = $this->getColumn()->getData('width'); - if (($customWidth === null) || (preg_match('/^[0-9]+%?$/', $customWidth))) { + if (($customWidth === null) || (preg_match('/^[0-9]+%?$/', (string)$customWidth))) { $width = $customWidth; } elseif (preg_match('/^([0-9]+)px$/', $customWidth, $matches)) { $width = (int)$matches[1]; diff --git a/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php b/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php index be198dab574..6b41ba93beb 100644 --- a/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php @@ -210,7 +210,7 @@ public function getCurrentPath() $node = $this->_getRequest()->getParam($this->getTreeNodeName()); if ($node) { $path = realpath($this->convertIdToPath($node)); - if (is_dir($path) && stripos($path, $currentPath) !== false) { + if ($path && is_dir($path) && stripos($path, $currentPath) !== false) { $currentPath = $path; } } diff --git a/app/code/core/Mage/Core/Helper/Cookie.php b/app/code/core/Mage/Core/Helper/Cookie.php index 73b0b7f9328..81422d33e89 100644 --- a/app/code/core/Mage/Core/Helper/Cookie.php +++ b/app/code/core/Mage/Core/Helper/Cookie.php @@ -123,7 +123,7 @@ public function getAcceptedSaveCookiesWebsiteIds() protected function _getAcceptedSaveCookiesWebsites() { $serializedList = $this->_cookieModel->get(self::IS_USER_ALLOWED_SAVE_COOKIE); - $unSerializedList = json_decode($serializedList, true); + $unSerializedList = $serializedList ? json_decode($serializedList, true) : null; return is_array($unSerializedList) ? $unSerializedList : []; } diff --git a/app/code/core/Mage/Core/Model/Config.php b/app/code/core/Mage/Core/Model/Config.php index e5a6fb86b6d..9cc7b792e67 100644 --- a/app/code/core/Mage/Core/Model/Config.php +++ b/app/code/core/Mage/Core/Model/Config.php @@ -1795,7 +1795,7 @@ protected function _makeEventsLowerCase($area, Varien_Simplexml_Config $mergeMod $newEventName = strtolower($oldName); if (!isset($events->$newEventName)) { /** @var Mage_Core_Model_Config_Element $newNode */ - $newNode = $events->addChild($newEventName, $event); + $newNode = $events->addChild($newEventName, (string)$event); $newNode->extend($event); } unset($events->$oldName); diff --git a/app/code/core/Mage/Core/Model/Config/Element.php b/app/code/core/Mage/Core/Model/Config/Element.php index 980b5a30bb6..4555367266d 100644 --- a/app/code/core/Mage/Core/Model/Config/Element.php +++ b/app/code/core/Mage/Core/Model/Config/Element.php @@ -39,7 +39,7 @@ public function is($var, $value = true) } } - return !empty($flag) && (strcasecmp($value, (string)$flag) === 0); + return !empty($flag) && (strcasecmp((string)$value, (string)$flag) === 0); } /** diff --git a/app/code/core/Mage/Core/Model/Date.php b/app/code/core/Mage/Core/Model/Date.php index 9f8af7ebf17..0e7dc8a5653 100644 --- a/app/code/core/Mage/Core/Model/Date.php +++ b/app/code/core/Mage/Core/Model/Date.php @@ -103,7 +103,7 @@ public function gmtDate($format = null, $input = null) return false; } - return date($format, $date); + return date($format, (int)$date); } /** diff --git a/app/code/core/Mage/Core/Model/Layout.php b/app/code/core/Mage/Core/Model/Layout.php index f71096ec645..b71d87ce8d0 100644 --- a/app/code/core/Mage/Core/Model/Layout.php +++ b/app/code/core/Mage/Core/Model/Layout.php @@ -170,7 +170,7 @@ public function generateXml() continue; } if (!isset($block->attributes()->ignore)) { - $block->addAttribute('ignore', true); + $block->addAttribute('ignore', '1'); } } } diff --git a/app/code/core/Mage/Core/Model/Layout/Validator.php b/app/code/core/Mage/Core/Model/Layout/Validator.php index 92057e4aa7a..9bedeaf8621 100644 --- a/app/code/core/Mage/Core/Model/Layout/Validator.php +++ b/app/code/core/Mage/Core/Model/Layout/Validator.php @@ -232,10 +232,10 @@ public function validateTemplatePath(array $templatePaths) { /** @var Varien_Simplexml_Element $path */ foreach ($templatePaths as $path) { - if ($path->hasChildren()) { - $path = stripcslashes(trim((string) $path->children(), '"')); - } - if (strpos($path, '..' . DS) !== false) { + $path = $path->hasChildren() + ? stripcslashes(trim((string)$path->children(), '"')) + : (string)$path; + if (str_contains($path, '..' . DS)) { throw new Exception(); } } diff --git a/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php index c09e48cda90..b8fe6fa7eed 100644 --- a/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php @@ -260,7 +260,7 @@ public function prepareColumnsList(Varien_Db_Select $select, $groupByCondition = list($correlationName, $column, $alias) = $columnEntry; if ($column instanceof Zend_Db_Expr) { if ($alias !== null) { - if (preg_match('/(^|[^a-zA-Z_])^(SELECT)?(SUM|MIN|MAX|AVG|COUNT)\s*\(/i', $column, $matches)) { + if (preg_match('/(^|[^a-zA-Z_])^(SELECT)?(SUM|MIN|MAX|AVG|COUNT)\s*\(/i', (string)$column, $matches)) { $column = $this->prepareColumn($column, $groupByCondition); } $preparedColumns[strtoupper($alias)] = [null, $column, $alias]; diff --git a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php index 481c3bfef32..0c6b7b3e2c3 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php @@ -105,7 +105,7 @@ public function start($sessionName = null) // session cookie params $cookieParams = [ - 'lifetime' => $cookie->getLifetime(), + 'lifetime' => (int)$cookie->getLifetime(), 'path' => $cookie->getPath(), 'domain' => $cookie->getConfigDomain(), 'secure' => $cookie->isSecure(), diff --git a/app/code/core/Mage/Core/Model/Translate.php b/app/code/core/Mage/Core/Model/Translate.php index 0607b515d3e..2f5f4a2ec09 100644 --- a/app/code/core/Mage/Core/Model/Translate.php +++ b/app/code/core/Mage/Core/Model/Translate.php @@ -525,6 +525,9 @@ protected function _loadCache() return false; } $data = Mage::app()->loadCache($this->getCacheId()); + if (!$data) { + return false; + } $data = unserialize($data, ['allowed_classes' => false]); return $data; } diff --git a/app/code/core/Mage/Customer/Model/Address/Config.php b/app/code/core/Mage/Customer/Model/Address/Config.php index 1042c09dcbc..287a5029f5e 100644 --- a/app/code/core/Mage/Customer/Model/Address/Config.php +++ b/app/code/core/Mage/Customer/Model/Address/Config.php @@ -99,9 +99,9 @@ public function getFormats() foreach ($this->getNode('formats')->children() as $typeCode => $typeConfig) { $path = sprintf('%s%s', self::XML_PATH_ADDRESS_TEMPLATE, $typeCode); $type = new Varien_Object(); - $htmlEscape = strtolower($typeConfig->htmlEscape); + $htmlEscape = strtolower((string)$typeConfig->htmlEscape); $htmlEscape = !($htmlEscape == 'false' || $htmlEscape == '0' || $htmlEscape == 'no' - || !strlen($typeConfig->htmlEscape)); + || !strlen($htmlEscape)); $type->setCode($typeCode) ->setTitle((string)$typeConfig->title) ->setDefaultFormat(Mage::getStoreConfig($path, $store)) diff --git a/app/code/core/Mage/Eav/Model/Resource/Attribute/Collection.php b/app/code/core/Mage/Eav/Model/Resource/Attribute/Collection.php index ad3e9583c91..5376af7f9d0 100644 --- a/app/code/core/Mage/Eav/Model/Resource/Attribute/Collection.php +++ b/app/code/core/Mage/Eav/Model/Resource/Attribute/Collection.php @@ -151,7 +151,7 @@ protected function _initSelect() 'scope_table.%s', 'main_table.%s' ); - $expression = sprintf($expression, $columnName, $columnName, $columnName); + $expression = sprintf((string)$expression, $columnName, $columnName, $columnName); $this->addFilterToMap($columnName, $expression); $scopeColumns[$alias] = $columnName; } elseif (isset($extraColumns[$columnName])) { @@ -161,7 +161,7 @@ protected function _initSelect() 'scope_table.%s', 'additional_table.%s' ); - $expression = sprintf($expression, $columnName, $columnName, $columnName); + $expression = sprintf((string)$expression, $columnName, $columnName, $columnName); $this->addFilterToMap($columnName, $expression); $scopeColumns[$alias] = $columnName; } diff --git a/app/code/core/Mage/Eav/Model/Resource/Form/Attribute/Collection.php b/app/code/core/Mage/Eav/Model/Resource/Form/Attribute/Collection.php index 0e7d95842ac..5719de5189e 100644 --- a/app/code/core/Mage/Eav/Model/Resource/Form/Attribute/Collection.php +++ b/app/code/core/Mage/Eav/Model/Resource/Form/Attribute/Collection.php @@ -204,7 +204,7 @@ protected function _beforeLoad() $code = sprintf('scope_%s', $columnName); $expression = $connection->getCheckSql('sa.%s IS NULL', 'ea.%s', 'sa.%s'); $saColumns[$code] = new Zend_Db_Expr(sprintf( - $expression, + (string)$expression, $columnName, $columnName, $columnName @@ -213,7 +213,7 @@ protected function _beforeLoad() $code = sprintf('scope_%s', $columnName); $expression = $connection->getCheckSql('sa.%s IS NULL', 'ca.%s', 'sa.%s'); $saColumns[$code] = new Zend_Db_Expr(sprintf( - $expression, + (string)$expression, $columnName, $columnName, $columnName diff --git a/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml b/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml index b6c70181dcb..d049d9bb73c 100644 --- a/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml +++ b/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml @@ -24,7 +24,7 @@ helper('catalog/output'); ?> productAttribute($_product, $_product->getName(), 'name')))?> - helper('catalog/image')->init($_product, 'image')))?> + helper('catalog/image')->init($_product, 'image')))?> getProductUrl()))?>