We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Error with ternary operator in Volt Phalcon 4.0.4

I'm in the process of moving my sites to a new VPS. Everything has been working fine for quite some time on the old VPS, with PHP 7.1 and Phalcon 3.4. While testing on the new VPS, with PHP 7.4.2 and Phalcon 4.0.4, many of the pages on my test website work, but I'm getting this error on the contact page:

Exception: Syntax error, unexpected token IDENTIFIER(is) in ../app/views/_library/contact/contact.volt on line 103

<input type="submit" {{ (lib.button_class is defined ? 'class="' ~ lib.button_class ~ '"' : '') }} value="{{ page.contact.send }}">

When I replace 'is' by '==' I get:

Exception: Syntax error, unexpected token DEFINED in ../app/views/_library/contact/contact.volt on line 103

When I rewrite the code with {% if %}, it works, but I'd rather not have to change code with the ternary operator everywhere. From the Upgrade Guide, I understand that this should keep working.

So, this might be a bug in Volt.