unexpected dynamic data behavior when loading views |
04-14-2016, 03:54 PM
(This post was last modified: 04-14-2016, 03:55 PM by sneakyimp. Edit Reason: added code output to clarify )
It would appear that data I supply to one view sticks around when I load my second view. This is unexpected. If I supply an array of data when loading a view, I expect that data to dictate which variables are defined when the view gets processed.
For example, I have a controller method: PHP Code: public function somemethod() { Here is testview: PHP Code: <?php The output renders the view twice, as expected, but the second time it's rendered, val3 still has the value that was loaded the first time around. The output: Code: val1=one This val3 value is also still around if I use an entirely different view the second time: PHP Code: public function scope() { It would appear that somehow these vars are cached. This not at all the behavior I would expect and it does not appear to be described in documentation. It may also present a security issue to have any sensitive values cached. Is there some feature I don't know about that would 'wipe' the data supplied to my view? Seems to me that if you supply data to a view by using an array, then the view should receive that data and nothing more. |
Welcome Guest, Not a member yet? Register Sign In |