-
-
Notifications
You must be signed in to change notification settings - Fork 437
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 deprecation error for creation of dynamic property #3177
Conversation
The thing is, |
An alternative approach could be to use array instead (untested): public function __get($key)
{
+ if (array_key_exists($this->_config, $key)) {
+ return $this->_config[$key];
+ }
+
$underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key));
$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;
} |
@elidrissidev your solution is much better, you want to commit it or should I do it? |
I won't have the chance now, you can do it if you're free. |
I can never make a sandbox paypal account work but I've reworked this PR, I thought to check _config also for the underscored key... what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested. Accessing properties works fine and no more deprecation errors.
After #2759, when visiting a product page or the cart page (with developer mode) we get:
Deprecated functionality: Creation of dynamic property Mage_Paypal_Model_Config::$visible_on_product is deprecated in app/code/core/Mage/Paypal/Model/Config.php on line 781"
This PR partially reverts #2759 but only for 2 specific properties
How to test: