BehatHtmlFormatterPlugin
BehatHtmlFormatterPlugin copied to clipboard
Using PHP short array syntax is not compatible with PHP 5.3.x
Hi,
The readme specify a minimum PHP version of 5.3.x but I get the following error when using PHP 5.3.10:
Parse error: syntax error, unexpected '[' in /vagrant/sites/vendor/emuse/behat-html-formatter/src/Renderer/BaseRenderer.php on line 36
The troublemaker: if(in_array($renderer, ['Behat2', 'Twig', 'Minimal'])) {
Short array syntax was introduced in PHP 5.4 (see http://php.net/manual/en/migration54.new-features.php).
Thanks :)
I'm in the same situation.
The fix is just replacing ['Behat2', 'Twig', 'Minimal'] for array('Behat2', 'Twig', 'Minimal')
I'm in the same situation.
The fix is just replacing ['Behat2', 'Twig', 'Minimal'] for array('Behat2', 'Twig', 'Minimal')
Thank you, you saved my day!
What is the runtime setting to display this error? I'm using a shared host that uses php5.3.29-pl0-gentoo and I've tried each of the following and neither of them catch the short array syntax error, my server just prints a blank page:
ATTEMPT 1
ini_set("display_errors",1); ini_set("display_startup_errors",1); error_reporting(E_ALL); ini_set("html_errors","On");
ATTEMPT 2
ini_set("display_errors",1); ini_set("display_startup_errors",1); error_reporting(E_ALL & E_STRICT); ini_set("html_errors","On");
ATTEMPT 3
ini_set("display_errors",1); ini_set("display_startup_errors",1); error_reporting(E_ALL & E_STRICT); error_reporting(E_ALL & E_NOTICE & E_STRICT & E_DEPRECATED);