Skip to content

Magento 1.x Error on PHP 7.2

After upgrading on of my clients environment from PHP7 to PHP 7.2, the client reported not being able to open any customers in the admin dashboard. The logs showed the following error:

PHP Fatal error: Declaration of Mage_Customer_Model_Customer_Attribute_Source_Website::getAllOptions() must be compatible with Mage_Eav_Model_Entity_Attribute_Source_Table::getAllOptions($withEmpty = true, $defaultValues = false) in /app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Website.php on line 34

To fix this I add to overwrite a few Magento core files and change the function getAllOptions .

In order to still be able to update your Magento shop, copy the following files from /app/code/core/  to  /app/code/local .

Now copy the following files to you local folder:

/app/code/core/Mage/Customer/Model/Resource/Address/Attribute/Source/Country.php
/app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/Country.php
/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Group.php
/app/code/core/Mage/Customer/Model/Customer/Attribute/Source/Website.php

In those files you need to replace the following line

public function getAllOptions()

with

public function getAllOptions($withEmpty = true, $defaultValues = false)

 

Published inUncategorized

5 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *