Created
June 17, 2012 14:00
-
-
Save ajshort/2944626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/control/Session.php b/control/Session.php | |
index a4f13b5..e97d3ae 100644 | |
--- a/control/Session.php | |
+++ b/control/Session.php | |
@@ -295,13 +295,20 @@ class Session { | |
// We still want to do this even if we have strict path checking for legacy code | |
$var = &$this->data; | |
$diffVar = &$this->changedData; | |
- | |
+ | |
+ // Iterate twice over the names - once to see if the value needs to be changed, | |
+ // and secondly to get the changed data value. This is done to solve a problem | |
+ // where iterating over the diff var would create empty arrays, and the value | |
+ // would then not be set, inadvertently clearing session values. | |
foreach($names as $n) { | |
$var = &$var[$n]; | |
- $diffVar = &$diffVar[$n]; | |
} | |
if($var !== $val) { | |
+ foreach($names as $n) { | |
+ $diffVar = &$diffVar[$n]; | |
+ } | |
+ | |
$var = $val; | |
$diffVar = $val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment