Skip to content

Commit

Permalink
fix: PHP8 test error when constructing Mage_Core_Model_Config
Browse files Browse the repository at this point in the history
The constructor of Mage_Core_Model_Config inherits from Varien_Object and its first argument is written to $this->data. So when the "constructor" of Mage_Core_Model_Config kicks in, it wanted to write an array to a already populated $this->_data variable, which yields errors since PHP 7.1.
  • Loading branch information
Pascal Querner committed Mar 2, 2024
1 parent b2abcf0 commit b3da428
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class Mage_Core_Helper_EnvironmentConfigLoader extends Mage_Core_Helper_Abstract
* Override the store 'german' configuration:
* @example OPENMAGE_CONFIG__STORES__GERMAN__GENERAL__STORE_INFORMATION__NAME=store_german
*
* @param Mage_Core_Model_Config $xmlConfig
* @param Varien_Simplexml_Config $xmlConfig
* @return void
*/
public function overrideEnvironment(Mage_Core_Model_Config $xmlConfig)
public function overrideEnvironment(Varien_Simplexml_Config $xmlConfig)
{
$env = $this->getEnv();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ public function testBuildNodePath()
*/
public function testEnvOverrides(array $config)
{
error_reporting(0);
$xmlStruct = $this->getTestXml();

$xmlDefault = new Mage_Core_Model_Config($xmlStruct);
$xmlDefault = $xmlDefault->loadModulesConfiguration('config.xml', $xmlDefault);
$xml = new Mage_Core_Model_Config($xmlStruct);
$xml = $xml->loadModulesConfiguration('config.xml', $xml);
$xmlDefault = new \Varien_Simplexml_Config();
$xmlDefault->loadString($xmlStruct);
$xml = new \Varien_Simplexml_Config();
$xml->loadString($xmlStruct);

$this->assertEquals('test_default', (string)$xml->getNode('default/general/store_information/name'));
$this->assertEquals('test_website', (string)$xml->getNode('websites/base/general/store_information/name'));
Expand Down

0 comments on commit b3da428

Please sign in to comment.