Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP 8.2] Fixed some deprecation warnings #3155

Merged
merged 10 commits into from
Apr 11, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function __construct()
$this->setId('sales_order_create_coupons_form');
}

/**
* @return string
*/
public function getCouponCode()
{
return $this->getParentBlock()->getQuote()->getCouponCode();
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/ConfigurableSwatches/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function getHyphenatedString($str)
*/
public static function normalizeKey($key)
{
if ($key === null || $key === '') return '';
fballiano marked this conversation as resolved.
Show resolved Hide resolved
if (function_exists('mb_strtolower')) {
return trim(mb_strtolower($key, 'UTF-8'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getAllOptions($withEmpty = true, $defaultValues = false)
public function getOptionText($value)
{
$isMultiple = false;
if (strpos($value, ',')) {
if ($value && strpos($value, ',')) {
$isMultiple = true;
$value = explode(',', $value);
}
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Rule/Model/Condition/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ protected function _compareValues($validatedValue, $value, $strict = true)
if ($strict && is_numeric($validatedValue) && is_numeric($value)) {
return $validatedValue == $value;
} else {
$validatedValue = $validatedValue ?? '';
$validatePattern = preg_quote($validatedValue, '~');
if ($strict) {
$validatePattern = '^' . $validatePattern . '$';
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Sales/Model/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ public function getCouponCode(): string
* @param string $couponCode
* @return $this
*/
public function setCouponCode(string $couponCode) #static with php74
public function setCouponCode(string $couponCode)
{
return $this->setData('coupon_code', $couponCode);
}
Expand Down
9 changes: 8 additions & 1 deletion app/code/core/Mage/Sales/Model/Quote/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
* @method $this setCompany(string $value)
* @method string getCountryId()
* @method $this setCountryId(string $value)
* @method string getCouponCode()
* @method $this setCouponCode(string $value)
* @method string getCreatedAt()
* @method $this setCreatedAt(string $value)
Expand Down Expand Up @@ -1335,4 +1334,12 @@ public function getSubtotalWithDiscount()
{
return $this->getSubtotal() + $this->getDiscountAmount();
}

/**
* @return string
*/
public function getCouponCode(): string
{
return (string)$this->_getData('coupon_code');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<?php foreach ($tabs as $_tab): ?>
<?php if (!$this->canShowTab($_tab)): continue; endif; ?>
<li <?php if($this->getTabIsHidden($_tab)): ?> style="display:none"<?php endif ?>>
<a href="<?php echo $this->getTabUrl($_tab) ?>" id="<?php echo $this->getTabId($_tab) ?>" name="<?php echo $this->getTabId($_tab, false) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->getTabTitle($_tab)) ?>" class="tab-item-link <?php echo $this->getTabClass($_tab) ?><?php if (preg_match('/\s?ajax\s?/', $_tab->getClass())) {?> notloaded<?php }?>">
<a href="<?php echo $this->getTabUrl($_tab) ?>" id="<?php echo $this->getTabId($_tab) ?>" name="<?php echo $this->getTabId($_tab, false) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->getTabTitle($_tab)) ?>" class="tab-item-link <?php echo $this->getTabClass($_tab) ?><?php if (preg_match('/\s?ajax\s?/', $_tab->getClass() ?? '')) {?> notloaded<?php }?>">
<span><span class="changed" title="<?php echo Mage::helper('core')->quoteEscape($this->__('The information in this tab has been changed.')) ?>"></span><span class="error" title="<?php echo Mage::helper('core')->quoteEscape($this->__('This tab contains invalid data. Please solve the problem before saving.')) ?>"></span><?php echo $this->getTabLabel($_tab); ?></span>
</a>
<div id="<?php echo $this->getTabId($_tab) ?>_content" style="display:none;"><?php echo $this->getTabContent($_tab) ?></div>
Expand Down