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

Problem description

After SUPEE-7405 patch Sales Order Management screen in Magento Backend is blank or the following error is reported in PHP error log:
PHP Parse error: syntax error, unexpected '[' in app/code/core/Mage/Adminhtml/Helper/Sales.php on line 124

Cause

SUPEE-7405 is prepared with PHP 5.4 in mind, older PHP versions are incompatible with new language constructions used.

Solution

Change line 124 in app/code/core/Mage/Adminhtml/Helper/Sales.php from $links = []; to $links = array();:
--- app/code/core/Mage/Adminhtml/Helper/Sales.php
+++ app/code/core/Mage/Adminhtml/Helper/Sales.php

@@ -121,7 +121,7 @@
     public function escapeHtmlWithLinks($data, $allowedTags = null)
     {
         if (!empty($data) && is_array($allowedTags) && in_array('a', $allowedTags)) {
-            $links = [];
+            $links = array();
             $i = 1;
             $data = str_replace('%', '%%', $data);

Comments

Archived discussion

  1. Chris
    Thanks, That was a big miss from Magento.
  2. Jisse Reitsma
    Thanks for the post! I don’t consider this a really big miss from Magento though. If you want to keep Magento updated, it is at least as important to keep the rest of the stack updated as well. PHP 5.3 became deprecated 1,5 years ago (http://php.net/eol.php)) and upgrading PHP 5.3 is vital for any Magento shop-owner, security-wise and performance-wise. This nasty Magento bug at least forces shop-owners in the right direction ;)
  3. Ray Moncada
    Personally, the way the array is defined here makes me wonder that there will be other places where array declaration uses the new syntax. Thanks for the solution. “As of PHP 5.4 you can also use the short array syntax, which replaces array() with [].” http://php.net/manual/en/la….