-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Variable scope when is set as view param and rendered by getRender() #12648
Comments
Does this happen for 5.6.24 too? I thought it's only php 7 problem. |
Yes, for both version of PHP. |
@sergeyklay : I was wondering if Phalcon might be performing faster than it actually should be, since it likely is not be making copies of variables for each view, which may be required to resolve this problem. Either way, I just want to voice that I think this one is larger than it might seem (in complexity and priority), in order to do it right where it doesn't add a lot of overhead. |
Well tbh as far as i see this https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/view/engine/volt.zep#L114 The current symbol table is method i think here. This is causing this problem. I guess the workaround could be something like create anonymous function which will just accept parameters and create it and do render there? |
I should also note, that I am not using Volt. I am using vanilla phtml. I'm assuming the code may be similar, but wanted to note that this is not just a Volt issue. |
Yes - code is similar, i will try to work on it, and if my assumption will be correct i will do PR with fix. |
This issue is fixed on php 5, but still happens on php 7. On php 7 create_symbol_table isn't implemented at all in zephir. |
Can we add here label php7? @sergeyklay |
Fixed in the |
@sergeyklay Unfortunately, it seems this issue has not actually been fixed in PHP 7 and is still present in 3.3.1. I couldn't find the fix for this issue in the PR #12782 referenced above - is it possible that a commit got lost somehow? |
@sergeyklay Thanks a lot for your attention to this issue. This has bitten us when we moved from PHP 5 to PHP 7. Once confirmed, wouldn't it make sense to reopen this issue? |
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. |
@sergeyklay Just wanted to point out that the test for this failure condition still seems to be broken, unless it was fixed somewhere else and I missed it: cphalcon/tests/unit/Mvc/ViewTest.php Line 672 in caeac66
My pull request #13288 with the fix was closed without merging for some reason... |
@piit79 Your branch had conflicts so I couldn't merge it automatically. I merged these changes by hand into 3.4.x branch. The 3.3.x branch is no longer supported. We'll try to release 3.4.x ASAP. |
cphalcon/tests/unit/Mvc/ViewTest.php Lines 670 to 675 in ad71cf6
|
Perfect, thanks! I was looking in the wrong place then. And sorry for the double post :-) |
When I set view params and call getRender, the variables are visible in the view but out of their scope (in action) too.
Testing environment
Source files
https://github.com/slechtic/phalcon_variable_scope
The text was updated successfully, but these errors were encountered: