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

the variables in partials globalize after upgrade to 3.0.1 (volt) #12385

Closed
odat opened this Issue Nov 1, 2016 · 12 comments

Comments

Projects
None yet
8 participants
@odat

odat commented Nov 1, 2016

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,

@Jurigag

This comment has been minimized.

Member

Jurigag commented Nov 1, 2016

You have php 7 ? I think this is why it's happening, not because of 3.0.1

@odat

This comment has been minimized.

odat commented Nov 1, 2016

Yes php 7, but can i get some way to fix this issue

@Jurigag

This comment has been minimized.

Member

Jurigag commented Nov 3, 2016

Then do PR if you have any solution or it's just workaround ?

@seliver

This comment has been minimized.

seliver commented Feb 1, 2017

Has this issue been fixed? Workaround maybe?

@seliver

This comment has been minimized.

seliver commented Feb 1, 2017

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?

@Jurigag

This comment has been minimized.

Member

Jurigag commented Feb 1, 2017

I don't think there is right now @andresgutierrez any plans to fix this?

@alivex

This comment has been minimized.

alivex commented Apr 6, 2017

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.
@emiliodeg

This comment has been minimized.

Member

emiliodeg commented Jul 31, 2017

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

@Feloot

This comment has been minimized.

Feloot commented Feb 6, 2018

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

@stale stale bot added the stale label May 7, 2018

@sergeyklay sergeyklay self-assigned this May 8, 2018

@stale stale bot removed the stale label May 8, 2018

@stale stale bot added the stale label Aug 6, 2018

@stale stale bot closed this Aug 7, 2018

@emiliodeg

This comment has been minimized.

Member

emiliodeg commented Aug 7, 2018

This robot shouldn't close issues tagged as bugs

@Jurigag

This comment has been minimized.

Member

Jurigag commented Aug 7, 2018

I agree @sergeyklay

@Jurigag Jurigag reopened this Aug 7, 2018

@stale stale bot removed the stale label Aug 7, 2018

@stale stale bot added the stale label Nov 5, 2018

@niden niden removed the stale label Nov 6, 2018

@phalcon phalcon deleted a comment from stale bot Nov 20, 2018

@phalcon phalcon deleted a comment from stale bot Nov 20, 2018

@phalcon phalcon deleted a comment from stale bot Nov 20, 2018

@sergeyklay sergeyklay added this to the 3.4.2 milestone Nov 20, 2018

sergeyklay added a commit that referenced this issue Nov 20, 2018

sergeyklay added a commit that referenced this issue Nov 20, 2018

@sergeyklay

This comment has been minimized.

Member

sergeyklay commented Nov 20, 2018

I hope we managed to sort out with this issue finally here #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment