Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

$regex text search issue on similar server configurations

Running two servers, both with Phalcon 1.3.4 and Mongo 2.6.7 with identical flag settings as reported by phpinfo().

On my local server, I'm using this line of code to search through text, where $filter is the needle I'm searching for:

$country = Countries::find([[ 'name' => [ '$regex' => $filter, '$options' => 'i' ] ]]);

It works perfectly on my localhost running MAMP, but on my remote server, I'm receiving this error in my error.log and I'm seeing a white screen of death.

2015/02/04 16:12:33 [error] 1498#0: *81 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '[', expecting ')' in /var/www/php/backend/app/controllers/UserController.php on line 75"

The rest of my app works fine on my remote server. I can do CRUD with Mongo just fine. It boggles my mind why there's a parsing error just for this one line, which is identical on my remote and local servers.

Suggestions would be welcome. Phalcon is brilliant BTW.

edited Feb '15

The PHP version on your remote server is older then on your MAMP

You can change syntax of array from [] to array()