From 50f3948aaec45fcad797a22e886074d904da0b1a Mon Sep 17 00:00:00 2001 From: Aleh Hutnikau Date: Fri, 8 Apr 2016 17:15:44 +0300 Subject: [PATCH] Do not owerwrite variable --- src/qtism/runtime/expressions/MapResponseProcessor.php | 6 +++--- .../runtime/expressions/MapResponseProcessorTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qtism/runtime/expressions/MapResponseProcessor.php b/src/qtism/runtime/expressions/MapResponseProcessor.php index ab9a1851c..cba91e9d8 100644 --- a/src/qtism/runtime/expressions/MapResponseProcessor.php +++ b/src/qtism/runtime/expressions/MapResponseProcessor.php @@ -117,13 +117,13 @@ public function process() for ($i = 0; $i < count($mapEntries); $i++) { $mapKey = $rawMapKey = $mapEntries[$i]->getMapKey(); - + $processedVal = null; if ($val instanceof QtiString && $mapEntries[$i]->isCaseSensitive() === false) { - $val = mb_strtolower($val->getValue(), 'UTF-8'); + $processedVal = mb_strtolower($val->getValue(), 'UTF-8'); $mapKey = mb_strtolower($mapKey, 'UTF-8'); } - if (($val instanceof Comparable && $val->equals($mapKey) === true) || $val === $mapKey) { + if (($val instanceof Comparable && $val->equals($mapKey) === true) || $processedVal === $mapKey) { if (in_array($rawMapKey, $mapped, true) === false) { $result += $mapEntries[$i]->getMappedValue(); $mapped[] = $rawMapKey; diff --git a/test/qtismtest/runtime/expressions/MapResponseProcessorTest.php b/test/qtismtest/runtime/expressions/MapResponseProcessorTest.php index 466bf8a7b..0312df455 100644 --- a/test/qtismtest/runtime/expressions/MapResponseProcessorTest.php +++ b/test/qtismtest/runtime/expressions/MapResponseProcessorTest.php @@ -143,8 +143,8 @@ public function testMultipleCardinalityIdentifierToFloat() { Choice7 - - + +