On Magento 1.x upgrade the following error message is thrown:
PHP Fatal error: Uncaught Error: [] operator not supported for strings in app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.1-1.6.0.2.php:93
Stack trace:
#0 app/code/core/Mage/Core/Model/Resource/Setup.php(624): include()
#1 app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.6.0.1', '1.6.0.3')
#2 app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.6.0.1', '1.6.0.3')
#3 app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 app/code/core/Mage/Core/Model/App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
#6 app/Mage.php(686): Mage_Core_Model_App->run(Array)
#7 index.php(83): Mage::run('', 'store')
#8 {main}
thrown in app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.1-1.6.0.2.php on line 93
Cause
PHP version 7.1 or newer is used for Magento upgrade, old Magento files were prepared for older PHP versions where array assignment to strings was allowed.Solution
Use PHP 5.6 version for upgrades from older Magento versions. If it is not possible due to some reason or your host have only PHP 7.1 and newer, you can force it step up with the following change:--- app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.1-1.6.0.2.php +++ app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.1-1.6.0.2.php @@ -87,8 +87,9 @@ $newValue = ''; if (stripos($oldValue['path'], 'free_method') && isset($oldToNewMethodCodesMap[$oldValue['value']])) { $newValue = $oldToNewMethodCodesMap[$oldValue['value']]; } else if (stripos($oldValue['path'], 'allowed_methods')) { + $newValue = array(); foreach (explode(',', $oldValue['value']) as $shippingMethod) { if (isset($oldToNewMethodCodesMap[$shippingMethod])) { $newValue[] = $oldToNewMethodCodesMap[$shippingMethod]; }
Posted in: Fatal errors, Known issues