1

The regular one-page checkout (/checkout/onepage/) has stopped working following applying the 3 latest SUPEE patches.

exception 'Mage_Core_Exception' with message 'Invalid block type: ' in /var/www/html/myshop/app/Mage.php:595
Stack trace:
#0 /var/www/html/msyhop/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /var/www/html/myshop/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 /var/www/html/myshop/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', 'root')
#3 /var/www/html/myshop/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', 'root')
#4 /var/www/html/myshop/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_La$
#5 /var/www/html/myshop/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#6 /var/www/html/myshop/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#7 /var/www/html/myshop/app/code/core/Mage/Checkout/controllers/CartController.php(194): Mage_Core_Controller_Varien_Action->loadLayout()
#8 /var/www/html/myshop/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_CartController->indexAction()
#9 /var/www/html/myshop/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#10 /var/www/html/myshop/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /var/www/html/myshop/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#12 /var/www/html/myshop/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#13 /var/www/html/myshop/index.php(100): Mage::run('', 'store')
#14 {main}

Points #1,#2,and #3 all have an empty string in the block calls. This would suggest to me that a block has been declared/called in the layout with no type. However I cannot find an empty block declaration so far.

Does anyone have any suggestions how to speedily debug this type of issue?

Thanks

UPDATE Actually this turned out to be a problem with the php version. I tracked the error down to app/code/core/Mage/Checkout/Model/Type/Onepage.php

Parse error: syntax error, unexpected '[' in /var/www/html/myshop/app/code/core/Mage/Checkout/Model/Type/Onepage.php on line 732
Array
(
    [type] => 4
    [message] => syntax error, unexpected '['
    [file] => /var/www/html/msyhop/app/code/core/Mage/Checkout/Model/Type/Onepage.php
    [line] => 732
)

The line here uses an array reference syntax not valid for php 5.3 (which my server was) which has appeared after doing applying SUPEE-10572. By upgrading to 5.4 the checkout now works.

1 Answer 1

0

Actually this turned out to be a problem with the php version. I tracked the error down to app/code/core/Mage/Checkout/Model/Type/Onepage.php by turning on PHP show all errors and using a fatal_handler function to get the last error message. The captured error was

Parse error: syntax error, unexpected '[' in /var/www/html/myshop/app/code/core/Mage/Checkout/Model/Type/Onepage.php on line 732
Array
(
    [type] => 4
    [message] => syntax error, unexpected '['
    [file] => /var/www/html/msyhop/app/code/core/Mage/Checkout/Model/Type/Onepage.php
    [line] => 732
)

The line here uses an array reference syntax not valid for php 5.3 (which my server was) which has appeared after doing applying SUPEE-10572. By upgrading to 5.4 the checkout now works.

For reference, here is the handy bit of code I use at the top of my index.php file for debugging problems:

<?php
//...
$errorSHOW = false;


function fatal_handler() {
    $error = error_get_last();
    echo "<pre>";
    print_r($error);
    echo "</pre>";
}

if($errorSHOW){ //THIS WILL CAUSE AN ERROR TO ALWAYS SHOW.  THIS WILL BREAK JSON AND OTHER SCRIPTS
    ini_set('display_errors',1);
    error_reporting(E_ALL);
    register_shutdown_function("fatal_handler");
}
...//
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.