From 6d7e028f92540b466bab16bdbbbaa5966bc5f5b4 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 10 May 2014 12:03:54 +0200 Subject: [PATCH] Use a separate scope for "for" loops. Refs #6183 --- lib/config/aexpression.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp index 6295aab2a..be027f956 100644 --- a/lib/config/aexpression.cpp +++ b/lib/config/aexpression.cpp @@ -586,11 +586,12 @@ Value AExpression::OpFor(const AExpression* expr, const Dictionary::Ptr& locals) ObjectLock olock(arr); BOOST_FOREACH(const Value& value, arr) { - locals->Set(varname, value); - ascope->Evaluate(locals); - } + Dictionary::Ptr xlocals = make_shared(); + xlocals->Set("__parent", locals); + xlocals->Set(varname, value); - locals->Remove(varname); + ascope->Evaluate(xlocals); + } return Empty; }