We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Vague error in Phalcon, PHP Fatal error: Uncaught Exception 'Phalcon\\Mvc\\Model\\Exception' with message 'Unknown expression'

I posted about this on Stack Overflow thinking this was a general PHP problem, but I'm beginning to think this is an issue specific to Phalcon. [Stack Overflow thread]

PHP Fatal error:  Uncaught exception 'Phalcon\\Mvc\\Model\\Exception' with message 'Unknown expression' in /home/acarbonaro/testApplication/index.php:84\n
Stack trace:\n
0 [internal function]: Phalcon\\Mvc\\Model\\Query->_getExpression(274, false)\n
1 [internal function]: Phalcon\\Mvc\\Model\\Query->_prepareInsert()\n
2 [internal function]: Phalcon\\Mvc\\Model\\Query->parse()\n
3 [internal function]: Phalcon\\Mvc\\Model\\Query->execute(Array, NULL)\n
4 /home/acarbonaro/testApplication/index.php(84): Phalcon\\Mvc\\Model\\Manager->executeQuery('INSERT INTO Pro...', Array)\n
5 [internal function]: {closure}()\n
6 /home/acarbonaro/testApplication/index.php(115): Phalcon\\Mvc\\Micro->handle()\n
7 {main}\n
    thrown in /home/acarbonaro/testApplication/index.php on line 84


Are you using Phalcon 1.3.1?

edited May '14


php -v output:

PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch (cli) (built: Apr  4 2014 01:30:04)

apache2 -v output:

Server version: Apache/2.2.22 (Ubuntu)
Server built:   Apr 17 2014 21:49:25

I got that same error on these conditions:

  • Single param on query
  • Table also got one param

I solved this adding another random param to table and query. It seems the phalcon expects no table to be less than one parameter.

Good luck.