Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Exception thrown when using 'is defined' inside {{ }} in Volt #14476

Closed
sheroesde opened this issue Oct 16, 2019 · 11 comments
Closed

[BUG]: Exception thrown when using 'is defined' inside {{ }} in Volt #14476

sheroesde opened this issue Oct 16, 2019 · 11 comments
Assignees
Labels
bug A bug report status: low Low

Comments

@sheroesde
Copy link

In Volt (using Phalcon\Mvc\Volt\Simple) I sometimes using shorthand notation for IF/ELSE like:

{{ someVar is defined ? 'yes' : 'no' }}

In Phalcon 3.4 all is fine, but it is broken in 4.0.0-rc.1, where I get

Phalcon\Mvc\View\Exception: Syntax error, unexpected token IDENTIFIER(is) in /home/my-project/app/views/premium.volt
@zsilbi
Copy link
Member

zsilbi commented Oct 17, 2019

Confirmed, although it does work within the {% %} tags, for example:

{% set myVar = someVar is defined ? 'yes' : 'no' %}

@Jurigag
Copy link
Contributor

Jurigag commented Oct 17, 2019

Well as i see @sergeyklay was doing some changes to volt parsers etc lately so maybe it was some of his change?

@sergeyklay sergeyklay self-assigned this Oct 21, 2019
@elcreator
Copy link

same for me

{{ uploadedPhoto is user.avatar ? 'checked="checked"' : '' }}

Syntax error, unexpected token IDENTIFIER(is) in /....../views/registered/widgets/avatar.twig on line 31

@Jeckerson
Copy link
Member

@elcreator What version of Phalcon do you use?

@elcreator
Copy link

Version | 4.0.0-rc.3
Build Date | Nov 16 2019 20:03:22
Powered by Zephir | Version 0.12.10-fedc314
PHP Version | 7.2.24-1

@elcreator
Copy link

as temporary fix I have replaced "is" with "=="

@mvanvu
Copy link
Contributor

mvanvu commented Dec 2, 2019

The same for me {{ title is empty ? siteName : title }} => Syntax error, unexpected token IDENTIFIER(is) ...

Version | 4.0.0-rc.3
Php 7.3

@madrian-es
Copy link

What's the status on this? We have a lot of code written for v4.0.0-rc.1 and we can't update to the latest version since this will imply rewriting A LOT of code.

Do you expect this to be fixed any time soon, or should we go ahead and rewrite everything?

@sergeyklay
Copy link
Contributor

@madrian-es I'll try to sort out ASAP

@sergeyklay
Copy link
Contributor

Status update: I fixed the issue. Thinking about better internal implementation

@sergeyklay
Copy link
Contributor

Fixed in #14909

@niden niden added 4.0.6 and removed 4.1.0 labels Mar 13, 2020
@niden niden closed this as completed Mar 13, 2020
sergeyklay added a commit that referenced this issue Mar 13, 2020
Covered comments from #14476
niden pushed a commit that referenced this issue May 16, 2020
Covered comments from #14476
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
Archived in project
Development

No branches or pull requests

9 participants