From 6b915055faf9787fe20c7c664d2016614c76bb2e Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 31 Dec 2022 06:54:58 +0100 Subject: [PATCH] Cast type, ref #735 --- .../core/Mage/Admin/Model/Resource/User.php | 2 +- app/code/core/Mage/Admin/Model/User.php | 2 +- .../core/Mage/Adminhtml/Block/Api/Buttons.php | 2 +- .../Mage/Adminhtml/Block/Api/Editroles.php | 2 +- .../Product/Attribute/Set/Main/Formgroup.php | 4 +- .../Edit/Action/Attribute/Tab/Inventory.php | 2 +- .../Adminhtml/Block/Permissions/Buttons.php | 2 +- .../Report/Grid/Column/Renderer/Currency.php | 2 +- .../Block/Review/Rating/Detailed.php | 4 +- .../Adminhtml/Block/Sales/Items/Abstract.php | 2 +- .../System/Config/Form/Field/Datetime.php | 2 +- .../System/Config/Form/Field/Notification.php | 2 +- .../Block/Tax/Rate/Grid/Renderer/Data.php | 2 +- .../Adminhtml/Block/Tax/Rate/Toolbar/Save.php | 2 +- .../Widget/Grid/Column/Renderer/Currency.php | 6 +-- .../Widget/Grid/Column/Renderer/Price.php | 6 +-- .../Model/Customer/Renderer/Region.php | 2 +- .../Config/Backend/Currency/Abstract.php | 4 +- .../System/Config/Backend/Currency/Cron.php | 4 +- .../Model/System/Config/Backend/Log/Cron.php | 4 +- .../Config/Backend/Product/Alert/Cron.php | 4 +- .../System/Config/Backend/Sitemap/Cron.php | 4 +- .../controllers/Api/RoleController.php | 2 +- .../Catalog/Product/ReviewController.php | 2 +- .../Adminhtml/controllers/PollController.php | 2 +- .../core/Mage/Api/Model/Resource/Role.php | 2 +- .../core/Mage/Api/Model/Resource/User.php | 2 +- app/code/core/Mage/Api/Model/User.php | 2 +- .../Authorizenet/Model/Directpost/Request.php | 50 +++++++++---------- .../Model/Directpost/Response.php | 38 +++++++------- .../Mage/Backup/Model/Config/Backend/Cron.php | 4 +- .../Block/Catalog/Product/List/Partof.php | 4 +- .../Bundle/Block/Catalog/Product/Price.php | 2 +- .../core/Mage/Bundle/Model/Product/Type.php | 4 +- .../Catalog/Block/Product/List/Upsell.php | 8 +-- .../Mage/Catalog/Block/Product/Widget/New.php | 2 +- .../core/Mage/Catalog/Helper/Product/Flat.php | 4 +- .../core/Mage/Catalog/Helper/Product/Url.php | 2 +- app/code/core/Mage/Catalog/Model/Category.php | 2 +- .../Catalog/Model/Product/Attribute/Api.php | 2 +- .../Model/Product/Attribute/Tierprice/Api.php | 2 +- .../Product/Attribute/Tierprice/Api/V2.php | 2 +- .../Catalog/Model/Product/Compare/Item.php | 4 +- .../core/Mage/Catalog/Model/Product/Image.php | 2 +- .../Model/Product/Option/Type/Date.php | 10 ++-- .../Model/Product/Option/Type/File.php | 6 +-- .../core/Mage/Catalog/Model/Product/Type.php | 2 +- .../Catalog/Model/Product/Type/Abstract.php | 2 +- .../Mage/Catalog/Model/Resource/Category.php | 2 +- .../Catalog/Model/Resource/Category/Flat.php | 2 +- .../Model/Resource/Layer/Filter/Price.php | 2 +- .../Mage/CatalogInventory/Model/Observer.php | 4 +- .../CatalogInventory/Model/Stock/Item.php | 4 +- app/code/core/Mage/Core/Model/Locale.php | 4 +- .../Core/Model/Resource/Helper/Mysql4.php | 4 +- .../core/Mage/Core/Model/Translate/Inline.php | 2 +- .../core/Mage/Customer/Model/Customer.php | 4 +- .../Model/Convert/Adapter/Abstract.php | 2 +- app/code/core/Mage/Directory/Block/Data.php | 2 +- .../Downloadable/Model/Link/Api/Validator.php | 10 ++-- .../Eav/Model/Resource/Entity/Attribute.php | 2 +- .../Model/Export/Entity/Product.php | 2 +- app/code/core/Mage/Log/Helper/Data.php | 2 +- app/code/core/Mage/Log/Model/Visitor.php | 8 +-- .../core/Mage/Log/Model/Visitor/Online.php | 2 +- app/code/core/Mage/Page/Block/Html/Pager.php | 4 +- .../core/Mage/Page/Block/Template/Links.php | 4 +- .../core/Mage/Paypal/Model/Api/Abstract.php | 2 +- app/code/core/Mage/Paypal/Model/Express.php | 8 +-- .../Paypal/controllers/PayflowController.php | 2 +- .../controllers/PayflowadvancedController.php | 2 +- app/code/core/Mage/Persistent/Helper/Data.php | 2 +- .../core/Mage/Persistent/Model/Session.php | 2 +- .../Mage/Poll/controllers/VoteController.php | 4 +- .../Mage/Rating/Block/Entity/Detailed.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.3.php | 2 +- app/code/core/Mage/Rss/Block/Wishlist.php | 2 +- app/code/core/Mage/Rss/Helper/Order.php | 10 ++-- .../Mage/Rss/controllers/IndexController.php | 2 +- app/code/core/Mage/Sales/Model/Order.php | 2 +- app/code/core/Mage/Sales/Model/Quote.php | 2 +- .../Mage/Usa/Model/Shipping/Carrier/Dhl.php | 8 +-- .../Mage/Usa/Model/Shipping/Carrier/Ups.php | 2 +- lib/Mage/Archive/Tar.php | 14 +++--- lib/Mage/DB/Mysqli.php | 4 +- lib/Mage/HTTP/Client/Socket.php | 2 +- lib/Mage/System/Ftp.php | 4 +- lib/Varien/Data/Collection.php | 2 +- lib/Varien/Data/Collection/Db.php | 2 +- lib/Varien/Data/Form/Element/Checkboxes.php | 12 ++--- lib/Varien/Db/Adapter/Pdo/Mysql.php | 8 +-- lib/Varien/File/Uploader/Image.php | 4 +- .../Filter/Template/Tokenizer/Variable.php | 2 +- lib/Varien/Image.php | 2 +- 94 files changed, 203 insertions(+), 203 deletions(-) diff --git a/app/code/core/Mage/Admin/Model/Resource/User.php b/app/code/core/Mage/Admin/Model/Resource/User.php index 5b8d8903044..98cb724caeb 100644 --- a/app/code/core/Mage/Admin/Model/Resource/User.php +++ b/app/code/core/Mage/Admin/Model/Resource/User.php @@ -235,7 +235,7 @@ public function _saveRelations(Mage_Core_Model_Abstract $user) $adapter->delete($this->getTable('admin/role'), $conditions); foreach ($rolesIds as $rid) { - $rid = intval($rid); + $rid = (int) $rid; if ($rid > 0) { $role = Mage::getModel('admin/role')->load($rid); } else { diff --git a/app/code/core/Mage/Admin/Model/User.php b/app/code/core/Mage/Admin/Model/User.php index de9520a0582..069b2e5c1b8 100644 --- a/app/code/core/Mage/Admin/Model/User.php +++ b/app/code/core/Mage/Admin/Model/User.php @@ -180,7 +180,7 @@ protected function _beforeSave() $this->cleanPasswordsValidationData(); if (!is_null($this->getIsActive())) { - $data['is_active'] = intval($this->getIsActive()); + $data['is_active'] = (int) $this->getIsActive(); } $this->addData($data); diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php b/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php index 5b60e51ce91..058423727f4 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Buttons.php @@ -94,7 +94,7 @@ public function getSaveButtonHtml() public function getDeleteButtonHtml() { - if (intval($this->getRequest()->getParam('rid')) == 0) { + if ((int) $this->getRequest()->getParam('rid') == 0) { return; } return $this->getChildHtml('deleteButton'); diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php b/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php index 8875a7c11ae..ee077468bd2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Editroles.php @@ -53,7 +53,7 @@ protected function _beforeToHtml() 'content' => $this->getLayout()->createBlock('adminhtml/api_tab_rolesedit')->toHtml(), ]); - if (intval($roleId) > 0) { + if ((int) $roleId > 0) { $this->addTab('roles', [ 'label' => Mage::helper('adminhtml')->__('Role Users'), 'title' => Mage::helper('adminhtml')->__('Role Users'), diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php index fb4d391164d..44b952212af 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main/Formgroup.php @@ -74,8 +74,8 @@ protected function _prepareForm() protected function _getSetId() { - return (intval($this->getRequest()->getParam('id')) > 0) - ? intval($this->getRequest()->getParam('id')) + return ((int) $this->getRequest()->getParam('id') > 0) + ? (int) $this->getRequest()->getParam('id') : Mage::getModel('eav/entity_type') ->load(Mage::registry('entityType')) ->getDefaultAttributeSetId(); diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php index c6298f82478..3bd7466a261 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Inventory.php @@ -56,7 +56,7 @@ public function getFieldSuffix() public function getStoreId() { $storeId = $this->getRequest()->getParam('store'); - return intval($storeId); + return (int) $storeId; } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php index a0efd0d5814..57a6340cd83 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php @@ -94,7 +94,7 @@ public function getSaveButtonHtml() public function getDeleteButtonHtml() { - if (intval($this->getRequest()->getParam('rid')) == 0) { + if ((int) $this->getRequest()->getParam('rid') == 0) { return; } return $this->getChildHtml('deleteButton'); diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php index b75772e6d6e..bd456a6ae9e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Column/Renderer/Currency.php @@ -43,7 +43,7 @@ public function render(Varien_Object $row) return $data; } - $data = floatval($data) * $this->_getRate($row); + $data = (float) $data * $this->_getRate($row); $data = sprintf("%F", $data); $data = Mage::app()->getLocale()->currency($currency_code)->toCurrency($data); return $data; diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php b/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php index e8c7c85fac8..1a239134a68 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php @@ -80,10 +80,10 @@ public function getRating() ->setPositionOrder() ->load() ->addOptionToItems(); - if (intval($this->getRequest()->getParam('id'))) { + if ((int) $this->getRequest()->getParam('id')) { $this->_voteCollection = Mage::getModel('rating/rating_option_vote') ->getResourceCollection() - ->setReviewFilter(intval($this->getRequest()->getParam('id'))) + ->setReviewFilter((int) $this->getRequest()->getParam('id')) ->addOptionInfo() ->load() ->addRatingOptions(); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php index 518151d7cd5..35be092b2b0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php @@ -349,7 +349,7 @@ public function displayPriceInclTax(Varien_Object $item) $basePriceTax = 0; $priceTax = 0; - if (floatval($qty)) { + if ((float) $qty) { $basePriceTax = $item->getBasePrice() + $baseTax / $qty; $priceTax = $item->getPrice() + $tax / $qty; } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php index ba506b342c7..1c4a2541605 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Datetime.php @@ -31,6 +31,6 @@ class Mage_Adminhtml_Block_System_Config_Form_Field_Datetime extends Mage_Adminh protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); - return Mage::app()->getLocale()->date(intval($element->getValue()))->toString($format); + return Mage::app()->getLocale()->date((int) $element->getValue())->toString($format); } } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php index 6fd04a03fe5..ab8a2f0ee09 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Field/Notification.php @@ -32,6 +32,6 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $element->setValue(Mage::app()->loadCache('admin_notifications_lastcheck')); $format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); - return Mage::app()->getLocale()->date(intval($element->getValue()))->toString($format); + return Mage::app()->getLocale()->date((int) $element->getValue())->toString($format); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php index fec7eab0e2b..8ef8e306049 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php @@ -31,7 +31,7 @@ class Mage_Adminhtml_Block_Tax_Rate_Grid_Renderer_Data extends Mage_Adminhtml_Bl protected function _getValue(Varien_Object $row) { $data = parent::_getValue($row); - if (intval($data) == $data) { + if ((int) $data == $data) { return (string) number_format($data, 2); } if (!is_null($data)) { diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php index 8b205e8fe2b..bc0c8aa974f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Toolbar/Save.php @@ -118,7 +118,7 @@ public function getSaveButtonHtml() */ public function getDeleteButtonHtml() { - if (intval($this->getRequest()->getParam('rate')) == 0) { + if ((int) $this->getRequest()->getParam('rate') == 0) { return; } return $this->getChildHtml('deleteButton'); diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php index 4a85d9e3203..f95dc42d8b9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Currency.php @@ -50,7 +50,7 @@ public function render(Varien_Object $row) return $data; } - $data = floatval($data) * $this->_getRate($row); + $data = (float) $data * $this->_getRate($row); $sign = (bool)(int)$this->getColumn()->getShowNumberSign() && ($data > 0) ? '+' : ''; $data = sprintf("%F", $data); $data = Mage::app()->getLocale()->currency($currency_code)->toCurrency($data); @@ -85,10 +85,10 @@ protected function _getCurrencyCode($row) protected function _getRate($row) { if ($rate = $this->getColumn()->getRate()) { - return floatval($rate); + return (float) $rate; } if ($rate = $row->getData($this->getColumn()->getRateField())) { - return floatval($rate); + return (float) $rate; } return 1; } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php index 2a7b9f414ac..cd6c7022d6e 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Price.php @@ -49,7 +49,7 @@ public function render(Varien_Object $row) return $data; } - $data = floatval($data) * $this->_getRate($row); + $data = (float) $data * $this->_getRate($row); $data = sprintf("%F", $data); $data = Mage::app()->getLocale()->currency($currency_code)->toCurrency($data); return $data; @@ -83,10 +83,10 @@ protected function _getCurrencyCode($row) protected function _getRate($row) { if ($rate = $this->getColumn()->getRate()) { - return floatval($rate); + return (float) $rate; } if ($rate = $row->getData($this->getColumn()->getRateField())) { - return floatval($rate); + return (float) $rate; } return 1; } diff --git a/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php b/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php index 0c82cebd513..16ca2bc1609 100644 --- a/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php +++ b/app/code/core/Mage/Adminhtml/Model/Customer/Renderer/Region.php @@ -59,7 +59,7 @@ public function render(Varien_Data_Form_Element_Abstract $element) $regionCollection = self::$_regionCollections[$countryId]; } - $regionId = intval($element->getForm()->getElement('region_id')->getValue()); + $regionId = (int) $element->getForm()->getElement('region_id')->getValue(); $htmlAttributes = $element->getHtmlAttributes(); foreach ($htmlAttributes as $key => $attribute) { diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php index 1dd550608e3..805d12df486 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Abstract.php @@ -67,7 +67,7 @@ protected function _getCurrencyBase() $this->getScopeId() ); } - return strval($value); + return (string) $value; } /** @@ -84,6 +84,6 @@ protected function _getCurrencyDefault() $this->getScopeId() ); } - return strval($value); + return (string) $value; } } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php index 2050cb4f33c..45ef5c929da 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php @@ -39,8 +39,8 @@ protected function _afterSave() $frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY; $cronExprArray = [ - intval($time[1]), # Minute - intval($time[0]), # Hour + (int) $time[1], # Minute + (int) $time[0], # Hour ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month '*', # Month of the Year ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php index b797f6adc58..9b40da97c93 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php @@ -47,8 +47,8 @@ protected function _afterSave() if ($enabled) { $cronExprArray = [ - intval($time[1]), # Minute - intval($time[0]), # Hour + (int) $time[1], # Minute + (int) $time[0], # Hour ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month '*', # Month of the Year ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php index 3518fbed969..17a3edb2f6e 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php @@ -40,8 +40,8 @@ protected function _afterSave() $frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY; $cronExprArray = [ - intval($time[1]), # Minute - intval($time[0]), # Hour + (int) $time[1], # Minute + (int) $time[0], # Hour ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month '*', # Month of the Year ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php index 7c32143f733..6ef1edf3891 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php @@ -40,8 +40,8 @@ protected function _afterSave() $frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY; $cronExprArray = [ - intval($time[1]), # Minute - intval($time[0]), # Hour + (int) $time[1], # Minute + (int) $time[0], # Hour ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month '*', # Month of the Year ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php b/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php index 4007e189ef0..dd5a6f8ea2f 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php @@ -85,7 +85,7 @@ public function editRoleAction() $this->_initAction(); $roleId = $this->getRequest()->getParam('rid'); - if (intval($roleId) > 0) { + if ((int) $roleId > 0) { $breadCrumb = $this->__('Edit Role'); $breadCrumbTitle = $this->__('Edit Role'); $this->_title($this->__('Edit Role')); diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php index 4386b6796e0..39a816db2bf 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/ReviewController.php @@ -300,7 +300,7 @@ public function jsonProductInfoAction() { $response = new Varien_Object(); $id = $this->getRequest()->getParam('id'); - if (intval($id) > 0) { + if ((int) $id > 0) { $product = Mage::getModel('catalog/product') ->load($id); diff --git a/app/code/core/Mage/Adminhtml/controllers/PollController.php b/app/code/core/Mage/Adminhtml/controllers/PollController.php index 6a76241169d..7a785dc2603 100644 --- a/app/code/core/Mage/Adminhtml/controllers/PollController.php +++ b/app/code/core/Mage/Adminhtml/controllers/PollController.php @@ -175,7 +175,7 @@ public function validateAction() $_titles[] = $answer['title']; $answerModel = Mage::getModel('poll/poll_answer'); - if (intval($key) > 0) { + if ((int) $key > 0) { $answerModel->setId($key); } $answerModel->setAnswerTitle($answer['title']) diff --git a/app/code/core/Mage/Api/Model/Resource/Role.php b/app/code/core/Mage/Api/Model/Resource/Role.php index 203c3220944..f26909de3d5 100644 --- a/app/code/core/Mage/Api/Model/Resource/Role.php +++ b/app/code/core/Mage/Api/Model/Resource/Role.php @@ -54,7 +54,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) { - if (!intval($value) && is_string($value)) { + if (!(int) $value && is_string($value)) { $field = 'role_id'; } return parent::load($object, $value, $field); diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 80594a99b40..f9559c08346 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -270,7 +270,7 @@ public function _saveRelations(Mage_Core_Model_Abstract $user) ['user_id = ?' => (int) $user->getId()] ); foreach ($rolesIds as $rid) { - $rid = intval($rid); + $rid = (int) $rid; if ($rid > 0) { //$row = $this->load($user, $rid); $row = ['tree_level' => 0]; diff --git a/app/code/core/Mage/Api/Model/User.php b/app/code/core/Mage/Api/Model/User.php index a42dbc10a9f..6dc78a152d1 100644 --- a/app/code/core/Mage/Api/Model/User.php +++ b/app/code/core/Mage/Api/Model/User.php @@ -106,7 +106,7 @@ public function save() } if (!is_null($this->getIsActive())) { - $data['is_active'] = intval($this->getIsActive()); + $data['is_active'] = (int) $this->getIsActive(); } $this->setData($data); diff --git a/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php b/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php index 7a02c47f86e..97786c6278d 100644 --- a/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php +++ b/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php @@ -129,37 +129,37 @@ public function setDataFromOrder(Mage_Sales_Model_Order $order, Mage_Authorizene //need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript, but we need "" for null values. $billing = $order->getBillingAddress(); if (!empty($billing)) { - $this->setXFirstName(strval($billing->getFirstname())) - ->setXLastName(strval($billing->getLastname())) - ->setXCompany(strval($billing->getCompany())) - ->setXAddress(strval($billing->getStreet(1))) - ->setXCity(strval($billing->getCity())) - ->setXState(strval($billing->getRegion())) - ->setXZip(strval($billing->getPostcode())) - ->setXCountry(strval($billing->getCountry())) - ->setXPhone(strval($billing->getTelephone())) - ->setXFax(strval($billing->getFax())) - ->setXCustId(strval($billing->getCustomerId())) - ->setXCustomerIp(strval($order->getRemoteIp())) - ->setXCustomerTaxId(strval($billing->getTaxId())) - ->setXEmail(strval($order->getCustomerEmail())) - ->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer'))) - ->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email'))); + $this->setXFirstName((string) $billing->getFirstname()) + ->setXLastName((string) $billing->getLastname()) + ->setXCompany((string) $billing->getCompany()) + ->setXAddress((string) $billing->getStreet(1)) + ->setXCity((string) $billing->getCity()) + ->setXState((string) $billing->getRegion()) + ->setXZip((string) $billing->getPostcode()) + ->setXCountry((string) $billing->getCountry()) + ->setXPhone((string) $billing->getTelephone()) + ->setXFax((string) $billing->getFax()) + ->setXCustId((string) $billing->getCustomerId()) + ->setXCustomerIp((string) $order->getRemoteIp()) + ->setXCustomerTaxId((string) $billing->getTaxId()) + ->setXEmail((string) $order->getCustomerEmail()) + ->setXEmailCustomer((string) $paymentMethod->getConfigData('email_customer')) + ->setXMerchantEmail((string) $paymentMethod->getConfigData('merchant_email')); } $shipping = $order->getShippingAddress(); if (!empty($shipping)) { - $this->setXShipToFirstName(strval($shipping->getFirstname())) - ->setXShipToLastName(strval($shipping->getLastname())) - ->setXShipToCompany(strval($shipping->getCompany())) - ->setXShipToAddress(strval($shipping->getStreet(1))) - ->setXShipToCity(strval($shipping->getCity())) - ->setXShipToState(strval($shipping->getRegion())) - ->setXShipToZip(strval($shipping->getPostcode())) - ->setXShipToCountry(strval($shipping->getCountry())); + $this->setXShipToFirstName((string) $shipping->getFirstname()) + ->setXShipToLastName((string) $shipping->getLastname()) + ->setXShipToCompany((string) $shipping->getCompany()) + ->setXShipToAddress((string) $shipping->getStreet(1)) + ->setXShipToCity((string) $shipping->getCity()) + ->setXShipToState((string) $shipping->getRegion()) + ->setXShipToZip((string) $shipping->getPostcode()) + ->setXShipToCountry((string) $shipping->getCountry()); } - $this->setXPoNum(strval($payment->getPoNumber())); + $this->setXPoNum((string) $payment->getPoNumber()); return $this; } diff --git a/app/code/core/Mage/Authorizenet/Model/Directpost/Response.php b/app/code/core/Mage/Authorizenet/Model/Directpost/Response.php index c4c6fe64631..00d9af65394 100644 --- a/app/code/core/Mage/Authorizenet/Model/Directpost/Response.php +++ b/app/code/core/Mage/Authorizenet/Model/Directpost/Response.php @@ -124,28 +124,28 @@ public function generateSha2Hash($signatureKey) $order = Mage::getModel('sales/order')->loadByIncrementId($this->getData('x_invoice_num')); $billing = $order->getBillingAddress(); if (!empty($billing)) { - $this->setXFirstName(strval($billing->getFirstname())) - ->setXLastName(strval($billing->getLastname())) - ->setXCompany(strval($billing->getCompany())) - ->setXAddress(strval($billing->getStreet(1))) - ->setXCity(strval($billing->getCity())) - ->setXState(strval($billing->getRegion())) - ->setXZip(strval($billing->getPostcode())) - ->setXCountry(strval($billing->getCountry())) - ->setXPhone(strval($billing->getTelephone())) - ->setXFax(strval($billing->getFax())) - ->setXEmail(strval($order->getCustomerEmail())); + $this->setXFirstName((string) $billing->getFirstname()) + ->setXLastName((string) $billing->getLastname()) + ->setXCompany((string) $billing->getCompany()) + ->setXAddress((string) $billing->getStreet(1)) + ->setXCity((string) $billing->getCity()) + ->setXState((string) $billing->getRegion()) + ->setXZip((string) $billing->getPostcode()) + ->setXCountry((string) $billing->getCountry()) + ->setXPhone((string) $billing->getTelephone()) + ->setXFax((string) $billing->getFax()) + ->setXEmail((string) $order->getCustomerEmail()); } $shipping = $order->getShippingAddress(); if (!empty($shipping)) { - $this->setXShipToFirstName(strval($shipping->getFirstname())) - ->setXShipToLastName(strval($shipping->getLastname())) - ->setXShipToCompany(strval($shipping->getCompany())) - ->setXShipToAddress(strval($shipping->getStreet(1))) - ->setXShipToCity(strval($shipping->getCity())) - ->setXShipToState(strval($shipping->getRegion())) - ->setXShipToZip(strval($shipping->getPostcode())) - ->setXShipToCountry(strval($shipping->getCountry())); + $this->setXShipToFirstName((string) $shipping->getFirstname()) + ->setXShipToLastName((string) $shipping->getLastname()) + ->setXShipToCompany((string) $shipping->getCompany()) + ->setXShipToAddress((string) $shipping->getStreet(1)) + ->setXShipToCity((string) $shipping->getCity()) + ->setXShipToState((string) $shipping->getRegion()) + ->setXShipToZip((string) $shipping->getPostcode()) + ->setXShipToCountry((string) $shipping->getCountry()); } $message = '^'; diff --git a/app/code/core/Mage/Backup/Model/Config/Backend/Cron.php b/app/code/core/Mage/Backup/Model/Config/Backend/Cron.php index cd689925679..e80a8bb9b24 100644 --- a/app/code/core/Mage/Backup/Model/Config/Backend/Cron.php +++ b/app/code/core/Mage/Backup/Model/Config/Backend/Cron.php @@ -51,8 +51,8 @@ protected function _afterSave() if ($enabled) { $cronExprArray = [ - intval($time[1]), # Minute - intval($time[0]), # Hour + (int) $time[1], # Minute + (int) $time[0], # Hour ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month '*', # Month of the Year ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php index 7084dce8b9e..81f42cdb3fe 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php @@ -106,8 +106,8 @@ public function getRowCount() */ public function setColumnCount($columns) { - if (intval($columns) > 0) { - $this->_columnCount = intval($columns); + if ((int) $columns > 0) { + $this->_columnCount = (int) $columns; } return $this; } diff --git a/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php b/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php index b5bebfbfadb..60e53d5e084 100644 --- a/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/core/Mage/Bundle/Block/Catalog/Product/Price.php @@ -45,7 +45,7 @@ public function isRatesGraterThenZero() $_request->setProductClassId($this->getProduct()->getTaxClassId()); $currentTax = Mage::getSingleton('tax/calculation')->getRate($_request); - return (floatval($defaultTax) > 0 || floatval($currentTax) > 0); + return ((float) $defaultTax > 0 || (float) $currentTax > 0); } /** diff --git a/app/code/core/Mage/Bundle/Model/Product/Type.php b/app/code/core/Mage/Bundle/Model/Product/Type.php index 107c4052950..d9e24adc668 100644 --- a/app/code/core/Mage/Bundle/Model/Product/Type.php +++ b/app/code/core/Mage/Bundle/Model/Product/Type.php @@ -445,7 +445,7 @@ public function updateQtyOption($options, Varien_Object $option, $value, $produc foreach ($options as &$option) { if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) { if ($optionUpdateFlag) { - $option->setValue(intval($option->getValue())); + $option->setValue((int) $option->getValue()); } else { $option->setValue($value); } @@ -466,7 +466,7 @@ public function updateQtyOption($options, Varien_Object $option, $value, $produc */ public function prepareQuoteItemQty($qty, $product = null) { - return intval($qty); + return (int) $qty; } /** diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php b/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php index 8f82b1039a8..0827c33311c 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php @@ -128,8 +128,8 @@ public function getRowCount() */ public function setColumnCount($columns) { - if (intval($columns) > 0) { - $this->_columnCount = intval($columns); + if ((int) $columns > 0) { + $this->_columnCount = (int) $columns; } return $this; } @@ -168,8 +168,8 @@ public function getIterableItem() */ public function setItemLimit($type, $limit) { - if (intval($limit) > 0) { - $this->_itemLimits[$type] = intval($limit); + if ((int) $limit > 0) { + $this->_itemLimits[$type] = (int) $limit; } return $this; } diff --git a/app/code/core/Mage/Catalog/Block/Product/Widget/New.php b/app/code/core/Mage/Catalog/Block/Product/Widget/New.php index 05eb8f6f1c6..8dee0444447 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Widget/New.php +++ b/app/code/core/Mage/Catalog/Block/Product/Widget/New.php @@ -120,7 +120,7 @@ public function getCacheKeyInfo() return array_merge(parent::getCacheKeyInfo(), [ $this->getDisplayType(), $this->getProductsPerPage(), - intval($this->getRequest()->getParam(self::PAGE_VAR_NAME)) + (int) $this->getRequest()->getParam(self::PAGE_VAR_NAME) ]); } diff --git a/app/code/core/Mage/Catalog/Helper/Product/Flat.php b/app/code/core/Mage/Catalog/Helper/Product/Flat.php index 297562240bf..e522795b5d5 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Flat.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Flat.php @@ -155,7 +155,7 @@ public function isBuiltAllStores() */ public function isAddFilterableAttributes() { - return intval(Mage::getConfig()->getNode(self::XML_NODE_ADD_FILTERABLE_ATTRIBUTES)); + return (int) Mage::getConfig()->getNode(self::XML_NODE_ADD_FILTERABLE_ATTRIBUTES); } /** @@ -165,7 +165,7 @@ public function isAddFilterableAttributes() */ public function isAddChildData() { - return intval(Mage::getConfig()->getNode(self::XML_NODE_ADD_CHILD_DATA)); + return (int) Mage::getConfig()->getNode(self::XML_NODE_ADD_CHILD_DATA); } /** diff --git a/app/code/core/Mage/Catalog/Helper/Product/Url.php b/app/code/core/Mage/Catalog/Helper/Product/Url.php index c860954f234..0ec6aa1506a 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Url.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Url.php @@ -99,7 +99,7 @@ public function __construct() $convertNode = Mage::getConfig()->getNode('default/url/convert'); if ($convertNode) { foreach ($convertNode->children() as $node) { - $this->_convertTable[strval($node->from)] = strval($node->to); + $this->_convertTable[(string) $node->from] = (string) $node->to; } } } diff --git a/app/code/core/Mage/Catalog/Model/Category.php b/app/code/core/Mage/Catalog/Model/Category.php index 25f82a15f2d..7d0116414da 100644 --- a/app/code/core/Mage/Catalog/Model/Category.php +++ b/app/code/core/Mage/Catalog/Model/Category.php @@ -589,7 +589,7 @@ public function getParentCategory() public function getParentId() { $parentIds = $this->getParentIds(); - return intval(array_pop($parentIds)); + return (int) array_pop($parentIds); } /** diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php index 400ba3f94b9..f3d6c7ddcbe 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php @@ -507,7 +507,7 @@ protected function _getAttribute($attribute) ->setEntityTypeId($this->_entityTypeId); if (is_numeric($attribute)) { - $model->load(intval($attribute)); + $model->load((int) $attribute); } else { $model->load($attribute, 'attribute_code'); } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php index 41748c8a731..d10eed288fd 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php @@ -146,7 +146,7 @@ public function prepareTierPrices($product, $tierPrices = null) } } - if (intval($tierPrice['website']) > 0 && !in_array($tierPrice['website'], $product->getWebsiteIds())) { + if ((int) $tierPrice['website'] > 0 && !in_array($tierPrice['website'], $product->getWebsiteIds())) { $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid tier prices. The product is not associated to the requested website.')); } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php index f3effefac8b..104f8601b49 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php @@ -61,7 +61,7 @@ public function prepareTierPrices($product, $tierPrices = null) } } - if (intval($tierPrice->website) > 0 && !in_array($tierPrice->website, $product->getWebsiteIds())) { + if ((int) $tierPrice->website > 0 && !in_array($tierPrice->website, $product->getWebsiteIds())) { $this->_fault('data_invalid', Mage::helper('catalog')->__('Invalid tier prices. The product is not associated to the requested website.')); } diff --git a/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php b/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php index a6b79b8b4fc..e1914da331d 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php +++ b/app/code/core/Mage/Catalog/Model/Product/Compare/Item.php @@ -143,8 +143,8 @@ public function addProductData($product) { if ($product instanceof Mage_Catalog_Model_Product) { $this->setProductId($product->getId()); - } elseif (intval($product)) { - $this->setProductId(intval($product)); + } elseif ((int) $product) { + $this->setProductId((int) $product); } return $this; diff --git a/app/code/core/Mage/Catalog/Model/Product/Image.php b/app/code/core/Mage/Catalog/Model/Product/Image.php index 00659281d78..26cd69ab9fb 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Image.php +++ b/app/code/core/Mage/Catalog/Model/Product/Image.php @@ -481,7 +481,7 @@ public function resize() */ public function rotate($angle) { - $angle = intval($angle); + $angle = (int) $angle; $this->getImageProcessor()->rotate($angle); return $this; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php index c0caf258699..fd573920656 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php @@ -67,11 +67,11 @@ public function validateUserValue($values) $this->setUserValue( [ 'date' => $value['date'] ?? '', - 'year' => isset($value['year']) ? intval($value['year']) : 0, - 'month' => isset($value['month']) ? intval($value['month']) : 0, - 'day' => isset($value['day']) ? intval($value['day']) : 0, - 'hour' => isset($value['hour']) ? intval($value['hour']) : 0, - 'minute' => isset($value['minute']) ? intval($value['minute']) : 0, + 'year' => isset($value['year']) ? (int) $value['year'] : 0, + 'month' => isset($value['month']) ? (int) $value['month'] : 0, + 'day' => isset($value['day']) ? (int) $value['day'] : 0, + 'hour' => isset($value['hour']) ? (int) $value['hour'] : 0, + 'minute' => isset($value['minute']) ? (int) $value['minute'] : 0, 'day_part' => $value['day_part'] ?? '', 'date_internal' => $value['date_internal'] ?? '', ] diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php index 35c11efba6c..0201b0f7911 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php @@ -809,13 +809,13 @@ protected function _getBytesIniValue($ini_key) // kilobytes if (stristr($_bytes, 'k')) { - $_bytes = intval($_bytes) * 1024; + $_bytes = (int) $_bytes * 1024; // megabytes } elseif (stristr($_bytes, 'm')) { - $_bytes = intval($_bytes) * 1024 * 1024; + $_bytes = (int) $_bytes * 1024 * 1024; // gigabytes } elseif (stristr($_bytes, 'g')) { - $_bytes = intval($_bytes) * 1024 * 1024 * 1024; + $_bytes = (int) $_bytes * 1024 * 1024 * 1024; } return (int)$_bytes; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Type.php b/app/code/core/Mage/Catalog/Model/Product/Type.php index ec8024fbfe3..dcdafececa7 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type.php @@ -224,7 +224,7 @@ public static function getTypesByPriority() $types = self::getTypes(); foreach ($types as $typeId => $typeInfo) { - $priority = isset($typeInfo['index_priority']) ? abs(intval($typeInfo['index_priority'])) : 0; + $priority = isset($typeInfo['index_priority']) ? abs((int) $typeInfo['index_priority']) : 0; if (!empty($typeInfo['composite'])) { $b[$typeId] = $priority; } else { diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php index 36363f2bed2..9abb44e0b5f 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php @@ -869,7 +869,7 @@ public function getForceChildItemQtyChanges($product = null) */ public function prepareQuoteItemQty($qty, $product = null) { - return floatval($qty); + return (float) $qty; } /** diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category.php b/app/code/core/Mage/Catalog/Model/Resource/Category.php index c2b7c5d7cf5..0d032fe9b11 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category.php @@ -542,7 +542,7 @@ public function getProductCount($category) $bind = ['category_id' => (int)$category->getId()]; $counts = $this->getReadConnection()->fetchOne($select, $bind); - return intval($counts); + return (int) $counts; } /** diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php index f02286bd980..bea29e458c6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php @@ -179,7 +179,7 @@ public function getMainTable() public function getMainStoreTable($storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID) { if (is_string($storeId)) { - $storeId = intval($storeId); + $storeId = (int) $storeId; } if ($this->getUseStoreTables() && $storeId) { $suffix = sprintf('store_%d', $storeId); diff --git a/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php b/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php index 283ccf04406..1aff80b2923 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php @@ -255,7 +255,7 @@ public function getCount($filter, $range) /** * Check and set correct variable values to prevent SQL-injections */ - $range = floatval($range); + $range = (float) $range; if ($range == 0) { $range = 1; } diff --git a/app/code/core/Mage/CatalogInventory/Model/Observer.php b/app/code/core/Mage/CatalogInventory/Model/Observer.php index 58fe359c9c6..2fc31fa339e 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Observer.php +++ b/app/code/core/Mage/CatalogInventory/Model/Observer.php @@ -70,7 +70,7 @@ public function addInventoryData($observer) { $product = $observer->getEvent()->getProduct(); if ($product instanceof Mage_Catalog_Model_Product) { - $productId = intval($product->getId()); + $productId = (int) $product->getId(); if (!isset($this->_stockItemsArray[$productId])) { $this->_stockItemsArray[$productId] = Mage::getModel('cataloginventory/stock_item'); } @@ -432,7 +432,7 @@ public function checkQuoteItemQty($observer) /** * if option's qty was updates we also need to update quote item qty */ - $quoteItem->setData('qty', intval($qty)); + $quoteItem->setData('qty', (int) $qty); } if (!is_null($result->getMessage())) { $option->setMessage($result->getMessage()); diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php index b223dc62b10..9bd40bea3a5 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php @@ -570,7 +570,7 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0) if (!$this->getIsQtyDecimal()) { $result->setHasQtyOptionUpdate(true); - $qty = intval($qty); + $qty = (int) $qty; /** * Adding stock data to quote item @@ -580,7 +580,7 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0) if (!is_numeric($qty)) { $qty = Mage::app()->getLocale()->getNumber($qty); } - $origQty = intval($origQty); + $origQty = (int) $origQty; $result->setOrigQty($origQty); } diff --git a/app/code/core/Mage/Core/Model/Locale.php b/app/code/core/Mage/Core/Model/Locale.php index 3eb1b107bb7..459e887136c 100644 --- a/app/code/core/Mage/Core/Model/Locale.php +++ b/app/code/core/Mage/Core/Model/Locale.php @@ -664,7 +664,7 @@ public function getNumber($value) } if (!is_string($value)) { - return floatval($value); + return (float) $value; } //trim spaces and apostrophes @@ -684,7 +684,7 @@ public function getNumber($value) $value = str_replace(',', '.', $value); } - return floatval($value); + return (float) $value; } /** 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 1ebae543352..a4a87507672 100644 --- a/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php @@ -229,8 +229,8 @@ protected function _prepareHaving(Varien_Db_Select $select, $autoReset = false) protected function _assembleLimit($query, $limitCount, $limitOffset, $columnList = []) { if ($limitCount !== null) { - $limitCount = intval($limitCount); - $limitOffset = intval($limitOffset); + $limitCount = (int) $limitCount; + $limitOffset = (int) $limitOffset; if ($limitOffset + $limitCount != $limitOffset + 1) { $columns = []; diff --git a/app/code/core/Mage/Core/Model/Translate/Inline.php b/app/code/core/Mage/Core/Model/Translate/Inline.php index 760c60c6743..2a18462c96e 100644 --- a/app/code/core/Mage/Core/Model/Translate/Inline.php +++ b/app/code/core/Mage/Core/Model/Translate/Inline.php @@ -579,7 +579,7 @@ public function getIsAjaxRequest() */ public function setIsAjaxRequest($flag) { - Mage::app()->getRequest()->setQuery('isAjax', intval((bool)$flag)); + Mage::app()->getRequest()->setQuery('isAjax', (int) (bool)$flag); return $this; } diff --git a/app/code/core/Mage/Customer/Model/Customer.php b/app/code/core/Mage/Customer/Model/Customer.php index 4e1ae3d153c..0b4e0e9275b 100644 --- a/app/code/core/Mage/Customer/Model/Customer.php +++ b/app/code/core/Mage/Customer/Model/Customer.php @@ -1184,7 +1184,7 @@ public function importFromTextArray(array $row) $regions->addRegionNameFilter($row['billing_region'])->load(); if ($regions) { foreach ($regions as $region) { - $regionId = intval($region->getId()); + $regionId = (int) $region->getId(); } } @@ -1228,7 +1228,7 @@ public function importFromTextArray(array $row) if ($regions) { foreach ($regions as $region) { - $regionId = intval($region->getId()); + $regionId = (int) $region->getId(); } } diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php index 073331f3784..0a9889f8bf6 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Adapter/Abstract.php @@ -76,6 +76,6 @@ public function getNumber($value) $number = str_replace($separator, '.', $number); } - return floatval($number); + return (float) $number; } } diff --git a/app/code/core/Mage/Directory/Block/Data.php b/app/code/core/Mage/Directory/Block/Data.php index f0de0497cfb..463996441a8 100644 --- a/app/code/core/Mage/Directory/Block/Data.php +++ b/app/code/core/Mage/Directory/Block/Data.php @@ -126,7 +126,7 @@ public function getRegionHtmlSelect() ->setTitle(Mage::helper('directory')->__('State/Province')) ->setId('state') ->setClass('required-entry validate-state') - ->setValue(intval($this->getRegionId())) + ->setValue((int) $this->getRegionId()) ->setOptions($options) ->getHtml(); Varien_Profiler::start('TEST: ' . __METHOD__); diff --git a/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php b/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php index 11fd1c95078..63b429e26ef 100644 --- a/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php +++ b/app/code/core/Mage/Downloadable/Model/Link/Api/Validator.php @@ -198,7 +198,7 @@ public function validateTitle(&$var) */ public function validatePrice(&$var) { - $var = is_numeric($var) ? floatval($var) : floatval(0); + $var = is_numeric($var) ? (float) $var : (float) 0; } /** @@ -208,7 +208,7 @@ public function validatePrice(&$var) */ public function validateNumOfDownloads(&$var) { - $var = is_numeric($var) ? intval($var) : 0; + $var = is_numeric($var) ? (int) $var : 0; } /** @@ -218,7 +218,7 @@ public function validateNumOfDownloads(&$var) */ public function validateUnlimited(&$var) { - $var = ((is_numeric($var) && $var >= 0 && $var <= 1) || (is_bool($var))) ? intval($var) : 0; + $var = ((is_numeric($var) && $var >= 0 && $var <= 1) || (is_bool($var))) ? (int) $var : 0; } /** @@ -228,7 +228,7 @@ public function validateUnlimited(&$var) */ public function validateShareable(&$var) { - $var = (is_numeric($var) && $var >= 0 && $var <= 2) ? intval($var) : 2; + $var = (is_numeric($var) && $var >= 0 && $var <= 2) ? (int) $var : 2; } /** @@ -265,7 +265,7 @@ public function validateUrl(&$var) */ public function validateOrder(&$var) { - $var = is_numeric($var) ? intval($var) : 0; + $var = is_numeric($var) ? (int) $var : 0; } /** diff --git a/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute.php b/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute.php index ed9a5549f78..7815d35d66c 100644 --- a/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute.php +++ b/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute.php @@ -107,7 +107,7 @@ public function loadByCode(Mage_Core_Model_Abstract $object, $entityTypeId, $cod */ private function _getMaxSortOrder(Mage_Core_Model_Abstract $object) { - if (intval($object->getAttributeGroupId()) > 0) { + if ((int) $object->getAttributeGroupId() > 0) { $adapter = $this->_getReadAdapter(); $bind = [ ':attribute_set_id' => $object->getAttributeSetId(), diff --git a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php index 39f702fde1b..6a71f5d8861 100644 --- a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php @@ -609,7 +609,7 @@ protected function _prepareExport() // Minimum Products limit $minProductsLimit = 500; - $limitProducts = intval(($memoryLimit * $memoryUsagePercent - memory_get_usage(true)) / $memoryPerProduct); + $limitProducts = (int) (($memoryLimit * $memoryUsagePercent - memory_get_usage(true)) / $memoryPerProduct); if ($limitProducts < $minProductsLimit) { $limitProducts = $minProductsLimit; } diff --git a/app/code/core/Mage/Log/Helper/Data.php b/app/code/core/Mage/Log/Helper/Data.php index b3efb531bac..b34f538d631 100644 --- a/app/code/core/Mage/Log/Helper/Data.php +++ b/app/code/core/Mage/Log/Helper/Data.php @@ -48,7 +48,7 @@ class Mage_Log_Helper_Data extends Mage_Core_Helper_Abstract */ public function __construct(array $data = []) { - $this->_logLevel = $data['log_level'] ?? intval(Mage::getStoreConfig(self::XML_PATH_LOG_ENABLED)); + $this->_logLevel = $data['log_level'] ?? (int) Mage::getStoreConfig(self::XML_PATH_LOG_ENABLED); } /** diff --git a/app/code/core/Mage/Log/Model/Visitor.php b/app/code/core/Mage/Log/Model/Visitor.php index ad259ba5eb4..658718405f5 100644 --- a/app/code/core/Mage/Log/Model/Visitor.php +++ b/app/code/core/Mage/Log/Model/Visitor.php @@ -162,8 +162,8 @@ public function initServerData() public static function getOnlineMinutesInterval() { $configValue = Mage::getStoreConfig('customer/online_customers/online_minutes_interval'); - return intval($configValue) > 0 - ? intval($configValue) + return (int) $configValue > 0 + ? (int) $configValue : self::DEFAULT_ONLINE_MINUTES_INTERVAL; } @@ -354,7 +354,7 @@ public function addIpData($data) public function addCustomerData($data) { $customerId = $data->getCustomerId(); - if (intval($customerId) <= 0) { + if ((int) $customerId <= 0) { return $this; } $customerData = Mage::getModel('customer/customer')->load($customerId); @@ -374,7 +374,7 @@ public function addCustomerData($data) public function addQuoteData($data) { $quoteId = $data->getQuoteId(); - if (intval($quoteId) <= 0) { + if ((int) $quoteId <= 0) { return $this; } $data->setQuoteData(Mage::getModel('sales/quote')->load($quoteId)); diff --git a/app/code/core/Mage/Log/Model/Visitor/Online.php b/app/code/core/Mage/Log/Model/Visitor/Online.php index 2d19ff23522..17914b4eccd 100644 --- a/app/code/core/Mage/Log/Model/Visitor/Online.php +++ b/app/code/core/Mage/Log/Model/Visitor/Online.php @@ -105,7 +105,7 @@ public function getUpdateFrequency() */ public function getOnlineInterval() { - $value = intval(Mage::getStoreConfig(self::XML_PATH_ONLINE_INTERVAL)); + $value = (int) Mage::getStoreConfig(self::XML_PATH_ONLINE_INTERVAL); if (!$value) { $value = Mage_Log_Model_Visitor::DEFAULT_ONLINE_MINUTES_INTERVAL; } diff --git a/app/code/core/Mage/Page/Block/Html/Pager.php b/app/code/core/Mage/Page/Block/Html/Pager.php index d4e83998aa5..b772594d3de 100644 --- a/app/code/core/Mage/Page/Block/Html/Pager.php +++ b/app/code/core/Mage/Page/Block/Html/Pager.php @@ -505,7 +505,7 @@ public function getJump() */ public function setFrameLength($frame) { - $frame = abs(intval($frame)); + $frame = abs((int) $frame); if ($frame == 0) { $frame = $this->_frameLength; } @@ -525,7 +525,7 @@ public function setFrameLength($frame) */ public function setJump($jump) { - $jump = abs(intval($jump)); + $jump = abs((int) $jump); if ($this->getJump() != $jump) { $this->_setFrameInitialized(false); $this->_jump = $jump; diff --git a/app/code/core/Mage/Page/Block/Template/Links.php b/app/code/core/Mage/Page/Block/Template/Links.php index 036017d9a9c..111a60cea91 100644 --- a/app/code/core/Mage/Page/Block/Template/Links.php +++ b/app/code/core/Mage/Page/Block/Template/Links.php @@ -117,7 +117,7 @@ protected function _addIntoPosition($link, $position) { $this->_links[$this->_getNewPosition($position)] = $link; - if (intval($position) > 0) { + if ((int) $position > 0) { ksort($this->_links); } @@ -243,7 +243,7 @@ protected function _beforeToHtml() */ protected function _getNewPosition($position = 0) { - if (intval($position) > 0) { + if ((int) $position > 0) { while (isset($this->_links[$position])) { $position++; } diff --git a/app/code/core/Mage/Paypal/Model/Api/Abstract.php b/app/code/core/Mage/Paypal/Model/Api/Abstract.php index 4dfea76966c..6f90ecc1dd1 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Abstract.php +++ b/app/code/core/Mage/Paypal/Model/Api/Abstract.php @@ -565,7 +565,7 @@ protected function _buildQuery($request) */ protected function _filterQty($value) { - return intval($value); + return (int) $value; } /** diff --git a/app/code/core/Mage/Paypal/Model/Express.php b/app/code/core/Mage/Paypal/Model/Express.php index 2627eaac5c6..9c4eb9fa6b7 100644 --- a/app/code/core/Mage/Paypal/Model/Express.php +++ b/app/code/core/Mage/Paypal/Model/Express.php @@ -304,8 +304,8 @@ public function void(Varien_Object $payment) public function capture(Varien_Object $payment, $amount) { $authorizationTransaction = $payment->getAuthorizationTransaction(); - $authorizationPeriod = abs(intval($this->getConfigData('authorization_honor_period'))); - $maxAuthorizationNumber = abs(intval($this->getConfigData('child_authorization_number'))); + $authorizationPeriod = abs((int) $this->getConfigData('authorization_honor_period')); + $maxAuthorizationNumber = abs((int) $this->getConfigData('child_authorization_number')); $order = $payment->getOrder(); $isAuthorizationCreated = false; @@ -656,7 +656,7 @@ public function canCapture() return false; } - $orderValidPeriod = abs(intval($this->getConfigData('order_valid_period'))); + $orderValidPeriod = abs((int) $this->getConfigData('order_valid_period')); $dateCompass = new DateTime($orderTransaction->getCreatedAt()); $dateCompass->modify('+' . $orderValidPeriod . ' days'); @@ -711,7 +711,7 @@ protected function _callDoAuthorize($amount, $payment, $parentTransactionId) */ protected function _isTransactionExpired(Mage_Sales_Model_Order_Payment_Transaction $transaction, $period) { - $period = intval($period); + $period = (int) $period; if ($period == 0) { return true; } diff --git a/app/code/core/Mage/Paypal/controllers/PayflowController.php b/app/code/core/Mage/Paypal/controllers/PayflowController.php index ee0f3540e36..9bcd3410da5 100644 --- a/app/code/core/Mage/Paypal/controllers/PayflowController.php +++ b/app/code/core/Mage/Paypal/controllers/PayflowController.php @@ -64,7 +64,7 @@ public function returnUrlAction() $gotoSection = $this->_cancelPayment( Mage::helper('core') ->stripTags( - strval($this->getRequest()->getParam('RESPMSG')) + (string) $this->getRequest()->getParam('RESPMSG') ) ); $redirectBlock->setGotoSection($gotoSection); diff --git a/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php b/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php index 3262aafcf7e..5fc611fc558 100644 --- a/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php +++ b/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php @@ -85,7 +85,7 @@ public function returnUrlAction() $gotoSection = $this->_cancelPayment( Mage::helper('core') ->stripTags( - strval($this->getRequest()->getParam('RESPMSG')) + (string) $this->getRequest()->getParam('RESPMSG') ) ); $redirectBlock->setGotoSection($gotoSection); diff --git a/app/code/core/Mage/Persistent/Helper/Data.php b/app/code/core/Mage/Persistent/Helper/Data.php index 3354a347baa..81e76791240 100644 --- a/app/code/core/Mage/Persistent/Helper/Data.php +++ b/app/code/core/Mage/Persistent/Helper/Data.php @@ -99,7 +99,7 @@ public function isShoppingCartPersist($store = null) */ public function getLifeTime($store = null) { - $lifeTime = intval(Mage::getStoreConfig(self::XML_PATH_LIFE_TIME, $store)); + $lifeTime = (int) Mage::getStoreConfig(self::XML_PATH_LIFE_TIME, $store); return ($lifeTime < 0) ? 0 : $lifeTime; } diff --git a/app/code/core/Mage/Persistent/Model/Session.php b/app/code/core/Mage/Persistent/Model/Session.php index 74e1703f7f3..375aac043a7 100644 --- a/app/code/core/Mage/Persistent/Model/Session.php +++ b/app/code/core/Mage/Persistent/Model/Session.php @@ -216,7 +216,7 @@ public function deleteExpired($websiteId = null) $lifetime = Mage::getConfig()->getNode( Mage_Persistent_Helper_Data::XML_PATH_LIFE_TIME, 'website', - intval($websiteId) + (int) $websiteId ); if ($lifetime) { diff --git a/app/code/core/Mage/Poll/controllers/VoteController.php b/app/code/core/Mage/Poll/controllers/VoteController.php index 2c197327311..1fc48868ae5 100644 --- a/app/code/core/Mage/Poll/controllers/VoteController.php +++ b/app/code/core/Mage/Poll/controllers/VoteController.php @@ -40,8 +40,8 @@ class Mage_Poll_VoteController extends Mage_Core_Controller_Front_Action */ public function addAction() { - $pollId = intval($this->getRequest()->getParam('poll_id')); - $answerId = intval($this->getRequest()->getParam('vote')); + $pollId = (int) $this->getRequest()->getParam('poll_id'); + $answerId = (int) $this->getRequest()->getParam('vote'); /** @var Mage_Poll_Model_Poll $poll */ $poll = Mage::getModel('poll/poll')->load($pollId); diff --git a/app/code/core/Mage/Rating/Block/Entity/Detailed.php b/app/code/core/Mage/Rating/Block/Entity/Detailed.php index e7f3fd9ad85..9627381177c 100644 --- a/app/code/core/Mage/Rating/Block/Entity/Detailed.php +++ b/app/code/core/Mage/Rating/Block/Entity/Detailed.php @@ -43,7 +43,7 @@ public function __construct() protected function _toHtml() { $entityId = Mage::app()->getRequest()->getParam('id'); - if (intval($entityId) <= 0) { + if ((int) $entityId <= 0) { return ''; } diff --git a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php index 9688ba133f7..4ba77caf605 100644 --- a/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Review/sql/review_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -37,7 +37,7 @@ $resource = Mage::getResourceSingleton('review/review'); // count quantity and aggregate packs per 100 items $total = $this->getConnection()->select()->from($this->getTable('review'), 'count(*)'); - $total = intval($this->getConnection()->fetchOne($total)); + $total = (int) $this->getConnection()->fetchOne($total); for ($i = 0; $i < $total; $i += 100) { $select = $this->getConnection()->select() ->from($this->getTable('review'), ['review_id', 'entity_pk_value']) diff --git a/app/code/core/Mage/Rss/Block/Wishlist.php b/app/code/core/Mage/Rss/Block/Wishlist.php index bdfb03eee78..e8c067e8a5f 100644 --- a/app/code/core/Mage/Rss/Block/Wishlist.php +++ b/app/code/core/Mage/Rss/Block/Wishlist.php @@ -80,7 +80,7 @@ protected function _getCustomer() $params = Mage::helper('core')->urlDecode($this->getRequest()->getParam('data')); $data = explode(',', $params); - $cId = abs(intval($data[0])); + $cId = abs((int) $data[0]); if ($cId && ($cId == Mage::getSingleton('customer/session')->getCustomerId())) { $this->_customer->load($cId); } diff --git a/app/code/core/Mage/Rss/Helper/Order.php b/app/code/core/Mage/Rss/Helper/Order.php index b57bddd4d87..8adfe2a9ffd 100644 --- a/app/code/core/Mage/Rss/Helper/Order.php +++ b/app/code/core/Mage/Rss/Helper/Order.php @@ -88,16 +88,16 @@ public function getOrderByStatusUrlKey($key) return null; } - $orderId = intval($data['order_id']); - $incrementId = intval($data['increment_id']); - $customerId = intval($data['customer_id']); + $orderId = (int) $data['order_id']; + $incrementId = (int) $data['increment_id']; + $customerId = (int) $data['customer_id']; /** @var Mage_Sales_Model_Order $order */ $order = Mage::getModel('sales/order')->load($orderId); if (!is_null($order->getId()) - && intval($order->getIncrementId()) === $incrementId - && intval($order->getCustomerId()) === $customerId + && (int) $order->getIncrementId() === $incrementId + && (int) $order->getCustomerId() === $customerId ) { return $order; } diff --git a/app/code/core/Mage/Rss/controllers/IndexController.php b/app/code/core/Mage/Rss/controllers/IndexController.php index 00f8584cad0..23b957269c8 100644 --- a/app/code/core/Mage/Rss/controllers/IndexController.php +++ b/app/code/core/Mage/Rss/controllers/IndexController.php @@ -146,7 +146,7 @@ protected function _getCustomer() $params = $this->_getHelper('core')->urlDecode($this->getRequest()->getParam('data')); $data = explode(',', $params); - $customerId = abs(intval($data[0])); + $customerId = abs((int) $data[0]); if ($customerId && ($customerId == Mage::getSingleton('customer/session')->getCustomerId())) { $this->_customer->load($customerId); } diff --git a/app/code/core/Mage/Sales/Model/Order.php b/app/code/core/Mage/Sales/Model/Order.php index 6b9d0ef8746..b561fa127c8 100644 --- a/app/code/core/Mage/Sales/Model/Order.php +++ b/app/code/core/Mage/Sales/Model/Order.php @@ -2376,7 +2376,7 @@ protected function _checkState() if ($this->getState() !== self::STATE_COMPLETE) { $this->_setState(self::STATE_COMPLETE, true, '', $userNotification); } - } elseif (floatval($this->getTotalRefunded()) || (!$this->getTotalRefunded() + } elseif ((float) $this->getTotalRefunded() || (!$this->getTotalRefunded() && $this->hasForcedCanCreditmemo()) /** * Order can be closed just in case when we have refunded amount. diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php index 79b3237c230..7fe94880e7e 100644 --- a/app/code/core/Mage/Sales/Model/Quote.php +++ b/app/code/core/Mage/Sales/Model/Quote.php @@ -1835,7 +1835,7 @@ public function isVirtual() */ public function getIsVirtual() { - return intval($this->isVirtual()); + return (int) $this->isVirtual(); } /** diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php index d179ccc52c5..c81036e65e3 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php @@ -833,8 +833,8 @@ protected function _parseXmlObject($shipXml) if (is_object($shipXml->Faults) && is_object($shipXml->Faults->Fault) && is_object($shipXml->Faults->Fault->Desc) - && intval($shipXml->Faults->Fault->Code) != self::SUCCESS_CODE - && intval($shipXml->Faults->Fault->Code) != self::SUCCESS_LABEL_CODE + && (int) $shipXml->Faults->Fault->Code != self::SUCCESS_CODE + && (int) $shipXml->Faults->Fault->Code != self::SUCCESS_LABEL_CODE ) { $code = (string)$shipXml->Faults->Fault->Code; $description = $shipXml->Faults->Fault->Desc; @@ -842,8 +842,8 @@ protected function _parseXmlObject($shipXml) } elseif (is_object($shipXml->Faults) && is_object($shipXml->Result->Code) && is_object($shipXml->Result->Desc) - && intval($shipXml->Result->Code) != self::SUCCESS_CODE - && intval($shipXml->Result->Code) != self::SUCCESS_LABEL_CODE + && (int) $shipXml->Result->Code != self::SUCCESS_CODE + && (int) $shipXml->Result->Code != self::SUCCESS_LABEL_CODE ) { $code = (string)$shipXml->Result->Code; $description = $shipXml->Result->Desc; diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php index fc659222d1d..1072da4a62b 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php @@ -1010,7 +1010,7 @@ protected function _parseXmlResponse($xmlResponse) if ($successConversion) { $costArr[$code] = $cost; - $priceArr[$code] = $this->getMethodPrice(floatval($cost), $code); + $priceArr[$code] = $this->getMethodPrice((float) $cost, $code); } } } diff --git a/lib/Mage/Archive/Tar.php b/lib/Mage/Archive/Tar.php index 415d865ba26..10907d79fb9 100644 --- a/lib/Mage/Archive/Tar.php +++ b/lib/Mage/Archive/Tar.php @@ -261,7 +261,7 @@ protected function _packToTar($skipRoot = false) if (!$skipRoot) { $header = $this->_composeHeader(); $data = $this->_readFile($file); - $data = str_pad($data, intval(((is_dir($file) ? 0 : filesize($file)) + 512 - 1) / 512) * 512, "\0"); + $data = str_pad($data, (int) (((is_dir($file) ? 0 : filesize($file)) + 512 - 1) / 512) * 512, "\0"); } $sub = ''; if (is_dir($file)) { @@ -276,7 +276,7 @@ protected function _packToTar($skipRoot = false) } } $tarData = $header . $data . $sub; - $tarData = str_pad($tarData, intval((strlen($tarData) - 1) / 1536) * 1536, "\0"); + $tarData = str_pad($tarData, (int) ((strlen($tarData) - 1) / 1536) * 1536, "\0"); return $tarData; } @@ -364,7 +364,7 @@ protected function _composeHeader($long = false) $longHeader = ''; if (!$long && strlen($nameFile) > 100) { $longHeader = $this->_composeHeader(true); - $longHeader .= str_pad($nameFile, intval((strlen($nameFile) + 512 - 1) / 512) * 512, "\0"); + $longHeader .= str_pad($nameFile, (int) ((strlen($nameFile) + 512 - 1) / 512) * 512, "\0"); } $header = []; $header['100-name'] = $long ? '././@LongLink' : substr($nameFile, 0, 100); @@ -499,13 +499,13 @@ protected function _parseHeader(&$pointer) $checksumOk = $header['checksum'] == $checksum; if (isset($header['name']) && $checksumOk) { if ($header['name'] == '././@LongLink' && $header['type'] == 'L') { - $realName = substr(fread($pointer, intval(($header['size'] + 512 - 1) / 512) * 512), 0, $header['size']); + $realName = substr(fread($pointer, (int) (($header['size'] + 512 - 1) / 512) * 512), 0, $header['size']); $headerMain = $this->_parseHeader($pointer); $headerMain['name'] = $realName; return $headerMain; } else { if ($header['size'] > 0) { - $header['data'] = substr(fread($pointer, intval(($header['size'] + 512 - 1) / 512) * 512), 0, $header['size']); + $header['data'] = substr(fread($pointer, (int) (($header['size'] + 512 - 1) / 512) * 512), 0, $header['size']); } else { $header['data'] = ''; } @@ -557,7 +557,7 @@ protected function _extractFileHeader() return $header; } - $realNameBlockSize = intval(($header['size'] + self::TAR_BLOCK_SIZE - 1) / self::TAR_BLOCK_SIZE) + $realNameBlockSize = (int) (($header['size'] + self::TAR_BLOCK_SIZE - 1) / self::TAR_BLOCK_SIZE) * self::TAR_BLOCK_SIZE; $realNameBlock = $archiveReader->read($realNameBlockSize); $realName = substr($realNameBlock, 0, $header['size']); @@ -664,7 +664,7 @@ public function extract($file, $source, $destination) } if ($header['type'] != 5) { - $skipBytes = intval(($header['size'] + self::TAR_BLOCK_SIZE - 1) / self::TAR_BLOCK_SIZE) + $skipBytes = (int) (($header['size'] + self::TAR_BLOCK_SIZE - 1) / self::TAR_BLOCK_SIZE) * self::TAR_BLOCK_SIZE; $archiveReader->read($skipBytes); } diff --git a/lib/Mage/DB/Mysqli.php b/lib/Mage/DB/Mysqli.php index 1b24c37efc3..693d82a9d95 100644 --- a/lib/Mage/DB/Mysqli.php +++ b/lib/Mage/DB/Mysqli.php @@ -460,7 +460,7 @@ public function updateAssocByKey($table, array $data, $value, $key = 'id') public function idsToString($ids) { if (is_scalar($ids)) { - return $this->escapeFieldValue(strval($ids)); + return $this->escapeFieldValue((string) $ids); } $out = []; foreach ($ids as $id) { @@ -510,7 +510,7 @@ public function simpleCount($table, $condition) if (empty($data['cnt'])) { return 0; } - return intval($data['cnt']); + return (int) $data['cnt']; } public function lastInsertId() diff --git a/lib/Mage/HTTP/Client/Socket.php b/lib/Mage/HTTP/Client/Socket.php index c7e7d0144a3..20e6fdc1eb0 100644 --- a/lib/Mage/HTTP/Client/Socket.php +++ b/lib/Mage/HTTP/Client/Socket.php @@ -411,7 +411,7 @@ protected function processResponse() if (count($line) != 3) { return $this->doError("Invalid response line returned from server: " . $responseLine); } - $this->_responseStatus = intval($line[1]); + $this->_responseStatus = (int) $line[1]; $this->processResponseHeaders(); $this->processRedirect(); diff --git a/lib/Mage/System/Ftp.php b/lib/Mage/System/Ftp.php index 4bb84fc4eb8..2b24e872dda 100644 --- a/lib/Mage/System/Ftp.php +++ b/lib/Mage/System/Ftp.php @@ -144,7 +144,7 @@ public function validateConnectionString($string) public function connect($string, $timeout = 900) { $params = $this->validateConnectionString($string); - $port = isset($params['port']) ? intval($params['port']) : 21; + $port = isset($params['port']) ? (int) $params['port'] : 21; $this->_conn = ftp_connect($params['host'], $port, $timeout); @@ -207,7 +207,7 @@ public function getcwd() if (empty($data[1])) { return false; } - if (intval($data[0]) != 257) { + if ((int) $data[0] != 257) { return false; } $out = trim($data[1], '"'); diff --git a/lib/Varien/Data/Collection.php b/lib/Varien/Data/Collection.php index 4e9a97a7b06..d505d84d2a6 100644 --- a/lib/Varien/Data/Collection.php +++ b/lib/Varien/Data/Collection.php @@ -247,7 +247,7 @@ public function getSize() if (is_null($this->_totalRecords)) { $this->_totalRecords = count($this->getItems()); } - return intval($this->_totalRecords); + return (int) $this->_totalRecords; } /** diff --git a/lib/Varien/Data/Collection/Db.php b/lib/Varien/Data/Collection/Db.php index a602c07aedb..147f25ca3d0 100644 --- a/lib/Varien/Data/Collection/Db.php +++ b/lib/Varien/Data/Collection/Db.php @@ -218,7 +218,7 @@ public function getSize() $sql = $this->getSelectCountSql(); $this->_totalRecords = (int)$this->getConnection()->fetchOne($sql, $this->_bindParams); } - return intval($this->_totalRecords); + return (int) $this->_totalRecords; } /** diff --git a/lib/Varien/Data/Form/Element/Checkboxes.php b/lib/Varien/Data/Form/Element/Checkboxes.php index 0e096d07036..5cdabfadbdf 100644 --- a/lib/Varien/Data/Form/Element/Checkboxes.php +++ b/lib/Varien/Data/Form/Element/Checkboxes.php @@ -126,13 +126,13 @@ public function getChecked($value) return; } if (!is_array($checked)) { - $checked = [strval($checked)]; + $checked = [(string) $checked]; } else { foreach ($checked as $k => $v) { - $checked[$k] = strval($v); + $checked[$k] = (string) $v; } } - if (in_array(strval($value), $checked)) { + if (in_array((string) $value, $checked)) { return 'checked'; } return ; @@ -146,13 +146,13 @@ public function getDisabled($value) { if ($disabled = $this->getData('disabled')) { if (!is_array($disabled)) { - $disabled = [strval($disabled)]; + $disabled = [(string) $disabled]; } else { foreach ($disabled as $k => $v) { - $disabled[$k] = strval($v); + $disabled[$k] = (string) $v; } } - if (in_array(strval($value), $disabled)) { + if (in_array((string) $value, $disabled)) { return 'disabled'; } } diff --git a/lib/Varien/Db/Adapter/Pdo/Mysql.php b/lib/Varien/Db/Adapter/Pdo/Mysql.php index 81646100a73..94076f1d083 100644 --- a/lib/Varien/Db/Adapter/Pdo/Mysql.php +++ b/lib/Varien/Db/Adapter/Pdo/Mysql.php @@ -4026,13 +4026,13 @@ protected function _parseTextSize($size) switch ($last) { case 'k': - $size = intval($size) * 1024; + $size = (int) $size * 1024; break; case 'm': - $size = intval($size) * 1024 * 1024; + $size = (int) $size * 1024 * 1024; break; case 'g': - $size = intval($size) * 1024 * 1024 * 1024; + $size = (int) $size * 1024 * 1024 * 1024; break; } @@ -4043,7 +4043,7 @@ protected function _parseTextSize($size) return Varien_Db_Ddl_Table::MAX_TEXT_SIZE; } - return intval($size); + return (int) $size; } /** diff --git a/lib/Varien/File/Uploader/Image.php b/lib/Varien/File/Uploader/Image.php index 11fb8f1dc8e..05712e9f828 100644 --- a/lib/Varien/File/Uploader/Image.php +++ b/lib/Varien/File/Uploader/Image.php @@ -69,7 +69,7 @@ public function resize($width = null, $height = null) */ public function rotate($degrees = null) { - $this->uploader->image_rotate = intval($degrees); + $this->uploader->image_rotate = (int) $degrees; } /** @@ -188,7 +188,7 @@ public function addWatermark($fileName = null, $position = "BL", $absoluteX = nu */ public function addReflection($height = "10%", $space = 0, $color = "#FFFFFF", $opacity = 60) { - if (intval($height) == 0) { + if ((int) $height == 0) { return; } diff --git a/lib/Varien/Filter/Template/Tokenizer/Variable.php b/lib/Varien/Filter/Template/Tokenizer/Variable.php index cfc945a5f09..5152b28572f 100644 --- a/lib/Varien/Filter/Template/Tokenizer/Variable.php +++ b/lib/Varien/Filter/Template/Tokenizer/Variable.php @@ -176,6 +176,6 @@ public function getNumber() $this->prev(); } - return floatval($value); + return (float) $value; } } diff --git a/lib/Varien/Image.php b/lib/Varien/Image.php index 257c9e63997..755c9bdaaf1 100644 --- a/lib/Varien/Image.php +++ b/lib/Varien/Image.php @@ -244,7 +244,7 @@ public function instruction() */ public function setImageBackgroundColor($color) { - $this->_getAdapter()->imageBackgroundColor = intval($color); + $this->_getAdapter()->imageBackgroundColor = (int) $color; } /**