Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
DeadCode\ClassMethod\RemoveUselessReturnTagRector::class,
DeadCode\MethodCall\RemoveNullArgOnNullDefaultParamRector::class,
DeadCode\Property\RemoveUselessVarTagRector::class,
EarlyReturn\If_\ChangeNestedIfsToEarlyReturnRector::class,
EarlyReturn\If_\RemoveAlwaysElseRector::class,
Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector::class,
Rector\Php71\Rector\List_\ListToArrayDestructRector::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,18 @@ public function getAttributeCode()
*/
public function canDisplayUseDefault()
{
if ($attribute = $this->getAttribute()) {
if (!$attribute->isScopeGlobal()
&& $this->getDataObject()
&& $this->getDataObject()->getId()
&& $this->getDataObject()->getStoreId()
) {
return true;
}
if (!$attribute = $this->getAttribute()) {
return false;
}

if (!$attribute->isScopeGlobal()
&& $this->getDataObject()
&& $this->getDataObject()->getId()
&& $this->getDataObject()->getStoreId()
) {
return true;
}

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ public function getFieldValueAsFloat(string $field): float

public function getConfigFieldValue($field)
{
if ($this->getStockItem()) {
if ($this->getStockItem()->getData('use_config_' . $field) == 0) {
return $this->getStockItem()->getData($field);
}
if (!$this->getStockItem()) {
return Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_ITEM . $field);
}

if ($this->getStockItem()->getData('use_config_' . $field) == 0) {
return $this->getStockItem()->getData($field);
}

return Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_ITEM . $field);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,11 @@ public function isChildCalculated($item = null): bool
public function getBundleOptions($item = null): array
{
$options = $this->getOrderItem()->getProductOptions();
if ($options) {
if (isset($options['bundle_options'])) {
return $options['bundle_options'];
}
if (!$options) {
return $options['bundle_options'] ?? [];
}
return [];

return $options['bundle_options'] ?? [];
}

/**
Expand Down
11 changes: 7 additions & 4 deletions app/code/core/Mage/Catalog/Block/Product/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,14 @@ protected function _getPriceBlock($productTypeId)
*/
protected function _getPriceBlockTemplate($productTypeId)
{
if (isset($this->_priceBlockTypes[$productTypeId])) {
if ($this->_priceBlockTypes[$productTypeId]['template'] != '') {
return $this->_priceBlockTypes[$productTypeId]['template'];
}
if (!isset($this->_priceBlockTypes[$productTypeId])) {
return $this->_priceBlockDefaultTemplate;
}

if ($this->_priceBlockTypes[$productTypeId]['template'] != '') {
return $this->_priceBlockTypes[$productTypeId]['template'];
}

return $this->_priceBlockDefaultTemplate;
}

Expand Down
11 changes: 7 additions & 4 deletions app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,11 +727,14 @@ public function getOrderOptions($product = null)
#[\Override]
public function isVirtual($product = null)
{
if ($productOption = $this->getProduct($product)->getCustomOption('simple_product')) {
if ($optionProduct = $productOption->getProduct()) {
return $optionProduct->isVirtual();
}
if (!$productOption = $this->getProduct($product)->getCustomOption('simple_product')) {
return parent::isVirtual($product);
}

if ($optionProduct = $productOption->getProduct()) {
return $optionProduct->isVirtual();
}

return parent::isVirtual($product);
}

Expand Down
11 changes: 7 additions & 4 deletions app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,14 @@ public function getApplyTo()
public function getSourceModel()
{
$model = $this->getData('source_model');
if (empty($model)) {
if ($this->getBackendType() == 'int' && $this->getFrontendInput() == 'select') {
return $this->getDefaultSourceModel();
}
if (!empty($model)) {
return $model;
}

if ($this->getBackendType() == 'int' && $this->getFrontendInput() == 'select') {
return $this->getDefaultSourceModel();
}

return $model;
}

Expand Down
19 changes: 10 additions & 9 deletions app/code/core/Mage/Core/Controller/Varien/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,16 +797,17 @@ protected function _getRefererUrl()
*/
protected function _isUrlInternal($url)
{
if (str_contains($url, 'http')) {
/**
* Url must start from base secure or base unsecure url
*/
if (str_starts_with($url, Mage::app()->getStore()->getBaseUrl())
|| str_starts_with($url, Mage::app()->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true))
) {
return true;
}
if (!str_contains($url, 'http')) {
return false;
}

// Url must start from base secure or base unsecure url
if (str_starts_with($url, Mage::app()->getStore()->getBaseUrl())
|| str_starts_with($url, Mage::app()->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true))
) {
return true;
}

return false;
}

Expand Down
10 changes: 6 additions & 4 deletions app/code/core/Mage/Core/Helper/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,12 @@ public function isSerializedArrayOrObject($data)
*/
public function validateSerializedObject($str)
{
if ($this->isSerializedArrayOrObject($str)) {
if (!unserialize($str)) {
return false;
}
if (!$this->isSerializedArrayOrObject($str)) {
return true;
}

if (!unserialize($str)) {
return false;
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ public function beforeSave($object)
#[\Override]
public function validate($object)
{
if ($password = $object->getPassword()) {
if ($password == $object->getPasswordConfirm()) {
return true;
}
if (!$password = $object->getPassword()) {
return parent::validate($object);
}

if ($password == $object->getPasswordConfirm()) {
return true;
}

return parent::validate($object);
Expand Down
11 changes: 7 additions & 4 deletions app/code/core/Mage/Index/Model/Indexer/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,14 @@ public function matchEvent(Mage_Index_Model_Event $event)
*/
public function matchEntityAndType($entity, $type)
{
if (isset($this->_matchedEntities[$entity])) {
if (in_array($type, $this->_matchedEntities[$entity])) {
return true;
}
if (!isset($this->_matchedEntities[$entity])) {
return false;
}

if (in_array($type, $this->_matchedEntities[$entity])) {
return true;
}

return false;
}

Expand Down
11 changes: 7 additions & 4 deletions app/code/core/Mage/Rss/Block/Catalog/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ protected function _getPriceBlock($productTypeId)
*/
protected function _getPriceBlockTemplate($productTypeId)
{
if (isset($this->_priceBlockTypes[$productTypeId])) {
if ($this->_priceBlockTypes[$productTypeId]['template'] != '') {
return $this->_priceBlockTypes[$productTypeId]['template'];
}
if (!isset($this->_priceBlockTypes[$productTypeId])) {
return $this->_priceBlockDefaultTemplate;
}

if ($this->_priceBlockTypes[$productTypeId]['template'] != '') {
return $this->_priceBlockTypes[$productTypeId]['template'];
}

return $this->_priceBlockDefaultTemplate;
}

Expand Down
Loading