1

Symfony \ Component \ Debug \ Exception \ FatalErrorException syntax error, unexpected '[', expecting ')'

<?php echo Form::open(['to' => 'product-search', 'autocomplete' => 'off', 'id' => 'form-product-search', 'class' => 'form-inline', 'style' => 'text-align:center']); ?>

I'm not sure why i'm receiving this error after i migrate to ubuntu server. it used to be working fine on WAMP.

I tried commenting the code out too, it gives the same error, Any idea?

2 Answers 2

6

You might run on PHP < 5.4, so you need to define the array with the classic definition:

 <?php echo Form::open(array('to' => 'product-search', 'autocomplete' => 'off', 'id' => 'form-product-search', 'class' => 'form-inline', 'style' => 'text-align:center')); ?>

(and do this on every array declaration with [])... or upgrade to PHP 5.4+ :-)

Sign up to request clarification or add additional context in comments.

Comments

4

This error is occured due to your PHP Version.

['to' => 'product-search', 'autocomplete' => 'off', 'id' => 'form-product-search', 'class' => 'form-inline', 'style' => 'text-align:center']

You can't defined array like this in PHP < 5.4 version.

1 Comment

Okay Thanks, i will check the version out

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.