Note: This is a historical reference, not a current security baseline. Magento 1 is end-of-life.

The following exception is printed after upgrade to OpenMage:

Warning: unserialize() expects exactly 1 parameter, 2 given  in app/code/core/Mage/Core/Model/Cache.php on line 503

#0 [internal function]: mageCoreErrorHandler(2, 'unserialize() e...', 'app/co...', 503, Array)
#1 app/code/core/Mage/Core/Model/Cache.php(503): unserialize('a:8:{s:10:"bloc...', Array)
#2 app/code/core/Mage/Core/Model/Cache.php(537): Mage_Core_Model_Cache->_initOptions()
#3 app/code/core/Mage/Core/Model/App.php(1240): Mage_Core_Model_Cache->canUse('config')
#4 app/code/core/Mage/Core/Model/Config.php(425): Mage_Core_Model_App->useCache('config')
#5 app/code/core/Mage/Core/Model/Config.php(305): Mage_Core_Model_Config->_canUseCacheForInit()
#6 app/code/core/Mage/Core/Model/App.php(440): Mage_Core_Model_Config->loadModulesCache()
#7 app/code/core/Mage/Core/Model/App.php(370): Mage_Core_Model_App->_initModules()
#8 app/Mage.php(731): Mage_Core_Model_App->run(Array)
#9 index.php(78): Mage::run('', 'store')
#10 {main}
Other similar errors may be thrown from app/code/core/Mage/Core/Model/Store.php or app/code/core/Mage/Core/Model/Translate.php:

Warning: unserialize() expects exactly 1 parameter, 2 given  in app/code/core/Mage/Core/Model/Store.php on line 418
unserialize() expects exactly 1 parameter, 2 given  in app/code/core/Mage/Core/Model/Translate.php on line 538


Cause

The reason is commit cf25b8a24819a7e8b4e48653f5f57026414dde4a which introduced PHP5.6 incompatible changes. This commit was merged into 1.9.4.x tree in December 2020 and included in OpenMage v19.4.9 release.

Solution

Switch your PHP version to PHP 7.3+ (PHP7.0 is minimal version and PHP7.3 is current recommended version) prior to OpenMage upgrade.

If changing PHP version is not possible due to some reason you can temporarily revert the patch to let store run with PHP5.6 and re-apply it back when PHP/OS upgrade issues are sorted out.

Note, there were a few other PHP5.6 incompatible changes in OpenMage 1.9.4.x tree. There is a php56-compat fork with up-to-date changes merged with mainstream 1.9.4.x tree.



Comments

Archived discussion

  1. Raiden

    Hi

    Still getting an error even if we are using PHP7.3

    PHP 7.3.27 (cli) (built: Mar 4 2021 16:00:24) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader + ionCube24 v10.4.5, Copyright (c) 2002-2020, by ionCube Ltd. with Zend OPcache v7.3.27, Copyright (c) 1999-2018, by Zend TechnologiesWarning: unserialize() expects exactly 1 parameter, 2 given in app/code/core/Mage/Core/Model/Cache.php on line 503Warning: unserialize() expects exactly 1 parameter, 2 given in lib/Varien/Db/Adapter/Pdo/Mysql.php on line 1567

  2. Thomas
    I had the same problem, when executing the cronjob. I changed the path to php in the files mage (Line 28: MAGE_PHP_BIN="/usr/bin/php73") and in cron.sh (Line 39: PHP_BIN=/usr/bin/php73) and the error was gone.