Hello,
the variables in partials globalize, how i can set some of variable on some partials and don't defined on another one on the same view
for example in controller i pass id on view by
$this->view->id = '1' ;
in the view template :
{{ id }} {# now the id is 1 #}
{{ partial("some/partial",['id':'2','another':3]) }}
{{ id }} {# now the id is 2 #}
{{ another}} {# and i can use another now, it's defined!! #}
when i defined the some partial with another id , the id is overwritten on the old one on the page
Thanks,
You have php 7 ? I think this is why it's happening, not because of 3.0.1
Yes php 7, but can i get some way to fix this issue
Then do PR if you have any solution or it's just workaround ?
Has this issue been fixed? Workaround maybe?
This is due to zephir incompatibilities with php7: https://forum.phalconphp.com/discussion/14497/view-variables-are-surprising-bug-or-feature
@phalcon Is there a workaround for this?
I don't think there is right now @andresgutierrez any plans to fix this?
I can confirm the bug occurring on php7 alone. Especially, when I call getRender(). I'll post my code, if it helps fixing the issue
//User has firstName, lastName, email, and more...
$content = $this->view->getRender("mail", "newPass",
[
"user" => $user->firstName . ' ' . $user->lastName,
"base_url" => 'https://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']
]
);
// After this part, User has only firstName and lastName.
I found a new super behavior
{{ robot.getPart() }} //part object #....
{{ partial("_partials/show-part", ['part':robot.getPart()]) }} //render fine
{{ robot.getPart() }} //robot is null!!!!
pain solution
{% set part = robot.getPart() %} //part object #....
{{ partial("_partials/show-part", ['part':part]) }} //render fine
{{ robot.getPart() }} //robot is fine
Enviroment: PHP 7.0.21, Phalcon 3.2.1, Zephir 0.9.9, Apache 2, MariaDB 10, Windows 7
Hi,
I have this issue too and it's a real pain to work with on bigger scale projects ! Please, if you can, fix this as soon as possible
Many thanks in advance
Environement : Debian 9, Nginx 1.12, PHP 7.2.2, Phalcon 3.3.1
This robot shouldn't close issues tagged as bugs
I agree @sergeyklay
I hope we managed to sort out with this issue finally here https://github.com/phalcon/cphalcon/pull/13606. All necessary changes are already in the appropriate branch. We will try to release the next version in the coming days. Thank you for your patience, the report, and for helping us make Phalcon better.
Most helpful comment
This robot shouldn't close issues tagged as bugs