Skip to content

Commit

Permalink
[PHP 8.2] Fixed deprecation error for creation of dynamic property (#…
Browse files Browse the repository at this point in the history
…3177)

Co-authored-by: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com>
  • Loading branch information
fballiano and elidrissidev authored Apr 18, 2023
1 parent 8bd9785 commit 177461b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/code/core/Mage/Paypal/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@ class Mage_Paypal_Model_Config
'zh_XC',
];

/**
* @var array
*/
protected $_config = [];

/**
* Set method and store id, if specified
*
Expand Down Expand Up @@ -775,11 +780,19 @@ public function isMethodAvailable($methodCode = null)
*/
public function __get($key)
{
if (array_key_exists($key, $this->_config)) {
return $this->_config[$key];
}

$underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key));
if (array_key_exists($underscored, $this->_config)) {
return $this->_config[$underscored];
}

$value = Mage::getStoreConfig($this->_getSpecificConfigPath($underscored), $this->_storeId);
$value = $this->_prepareValue($underscored, $value);
$this->$key = $value;
$this->$underscored = $value;
$this->_config[$key] = $value;
$this->_config[$underscored] = $value;
return $value;
}

Expand Down

0 comments on commit 177461b

Please sign in to comment.