peedurrr peedurrr - 4 months ago 22
PHP Question

PHP parse error, unexpected '[' on empty array

I'm trying to install OpenDocman, and am getting this error:

Parse error: syntax error, unexpected '[' in blablahblah/TemplateRegistry.php on line 156


The line in question reads:

$this->found = [];


Which suggests to me that my version of php (5.3.29) doesn't like this syntax. I'm assuming that the intent is to set 'found' to an empty array.

What's the best way to tackle this please?

Answer

The short syntax for arrays was added to PHP in 5.4, so you can either upgrade PHP or use $this->found = array(); for the line of code.