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]: Volt is defined and array in #14816

Closed
ismail0234 opened this issue Feb 5, 2020 · 3 comments
Closed

[BUG]: Volt is defined and array in #14816

ismail0234 opened this issue Feb 5, 2020 · 3 comments
Assignees
Labels
bug A bug report status: medium Medium

Comments

@ismail0234
Copy link

ismail0234 commented Feb 5, 2020

Questions? Forum: https://phalcon.link/forum or Discord: https://phalcon.link/discord

Describe the bug
Using these two together will give the wrong result.

Steps to reproduce the behavior:

Provide minimal script to reproduce the issue

// WRONG Result:
{% if categoryIds is defined AND category['id'] in categoryIds %}
    checked
{% endif %}

// Correct Result:
{% if categoryIds is defined AND (category['id'] in categoryIds) %}
    checked
{% endif %}

Expected behavior
A clear and concise description of what you expected to happen.

// WRONG RESULT
<?php if ($this->isIncluded(isset($categoryIds) && $category['id'], $categoryIds)) { ?>
   checked
<php } ?>

// Correct RESULT
<?php if (isset($categoryIds) && $this->isIncluded($category['id'], $categoryIds)) { ?>
   checked
<php } ?>

Screenshots
If applicable, add screenshots to help explain your problem.

Details

  • Phalcon version: v3.4.5
  • PHP Version: 7.3
  • Operating System: Windows
  • Installation type: installing via package manager
  • Zephir version (if any): Latest
  • Server: FASTCGI
@ismail0234 ismail0234 added bug A bug report status: unverified Unverified labels Feb 5, 2020
@Jeckerson
Copy link
Member

Jeckerson commented Feb 7, 2020

Confirmed, here is screenshot of generated code from volt

image

Details
Phalcon version: 4.0.x
PHP version: 7.4

@Jeckerson Jeckerson added status: medium Medium bug A bug report 4.0.4 and removed bug A bug report status: unverified Unverified labels Feb 7, 2020
@Jeckerson Jeckerson added 4.0.5 and removed 4.0.4 labels Feb 15, 2020
@niden niden added 4.0.6 external dependency This issue depends on external issue to be resolved. and removed 4.0.5 labels Mar 8, 2020
@niden
Copy link
Member

niden commented Mar 10, 2020

This needs work on the PHQL parser since the right part after the && is not parsed on its own.

For now the workaround with parentheses works but the suggested syntax should work also.

@sergeyklay sergeyklay self-assigned this Mar 13, 2020
@sergeyklay sergeyklay removed the external dependency This issue depends on external issue to be resolved. label Mar 13, 2020
@sergeyklay
Copy link
Contributor

Fixed in 4.0.x branch. Thank you for the report, and for helping us make Phalcon better.

@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: medium Medium
Projects
Archived in project
Development

No branches or pull requests

4 participants