we've been given a Magento site to take over. I'm not familiar with Magento at all, but they have given us all files and DB schema. It all appears to be working on our server, apart from a strange parse error. When I add a product to my basket, and get sent to /checkout/cart/ the site dies (I see a blank screen).

The error log says:

PHP Parse error: syntax error, unexpected '[' in /app/code/local/C3/Checkout/Block/Cart/Totals.php on line 41

Line 41 is:


I can't find anyone else who has had this error. Does anyone have any ideas?

Thanks in advance!


Or if this is the only place where the other programmers put this code - you can simply replace the code with something like this:

$rates_values = array_values($rates);
| improve this answer | |
  • Thank-you michael - it was also in Shipping.php, but I amended the code and it is now working. Thank-you Tobias also - I had not thought about PHP version. – user1220969 Dec 22 '14 at 15:30
  • I can not suggest this solution as it's a modification of the core code, even if it's a small one. You'll have this problem again when upgrading Magento. – Tobias Dec 23 '14 at 11:01
  • As far as I know there is no such code in Magento core. Also from the error you can see that it's in app/code/local/ which is 100% not core. – michael Dec 23 '14 at 23:01

which version of PHP are you using?

This syntax is only available in PHP >=5.4.

So I would suggest you upgrade. ;)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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