Magento 1.9 Checkout Error – ‘Zend_Json Decoding Failed: Syntax Error’ When Submitting Order

checkouterrorjsonmagento-1.9php-7

I recently switched from Apache/PHP 5.5 to a new nginx/PHP 7.0.4 server and now I am getting once in a while a "Decoding failed: Syntax error" when customers try to checkout, apparently when they click the submit order button.

I am unable to reproduce the bug on my side, it happens in about 1 of 50 orders, sometimes also in the customer panel, so it seems to affect only logged users or SSL connections. As I am unable to reproduce the behaviour, I don't know what is happening on the frontend, but customers seem to be able to click the button again, because in most cases the order gets through after 2 error messages. The store is currently running Magento 1.9.2.1 and the server Centos7.

I know that the error is generated in Json.php in the function "decode".

Does anyone have an idea what could cause this and how to debug this? One way would be to log all JSONS with an error and then look at the syntax, but maybe someone already has a solution?

Here is an excerpt of the trace:

#0 /usr/share/nginx/html/app/code/core/Mage/Core/Helper/Data.php(659): Zend_Json::decode('', 1)
#1 /usr/share/nginx/html/app/code/core/Mage/Persistent/Model/Session.php(133): Mage_Core_Helper_Data->jsonDecode(NULL)
#2 /usr/share/nginx/html/app/code/core/Mage/Core/Model/Abstract.php(226): Mage_Persistent_Model_Session->_afterLoad()
#3 /usr/share/nginx/html/app/code/core/Mage/Persistent/Model/Session.php(154): Mage_Core_Model_Abstract->load('deleted', 'key')
#4 /usr/share/nginx/html/app/code/core/Mage/Persistent/Helper/Session.php(67): Mage_Persistent_Model_Session->loadByCookieKey()
#5 /usr/share/nginx/html/app/code/core/Mage/Persistent/Helper/Session.php(91): Mage_Persistent_Helper_Session->getSession()
#6 /usr/share/nginx/html/app/code/core/Mage/Persistent/Model/Observer.php(177): Mage_Persistent_Helper_Session->isPersistent()
#7 /usr/share/nginx/html/app/code/core/Mage/Core/Model/App.php(1357): Mage_Persistent_Model_Observer->emulateQuote(Object(Varien_Event_Observer))
#8 /usr/share/nginx/html/app/code/core/Mage/Core/Model/App.php(1336): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Persistent_Model_Observer), 'emulateQuote', Object(Varien_Event_Observer))
#9 /usr/share/nginx/html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#10 /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Varien/Action.php(527): Mage::dispatchEvent('controller_acti...', Array)
#11 /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Front/Action.php(69): Mage_Core_Controller_Varien_Action->preDispatch()

Best Answer

Update: This has been resolved in Inchoo's Magento PHP 7 compatibility module: https://github.com/Inchoo/Inchoo_PHP7

Related Topic