Skip to content

Commit 7299326

Browse files
msohailhussainrashidsp
authored andcommitted
fix(whitelisting): Whitelisted variation should continue when no valid variation is found. (#123)
1 parent add5d8b commit 7299326

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/Optimizely/DecisionService/DecisionService.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,13 @@ private function getWhitelistedVariation(Experiment $experiment, $userId)
345345
if (!is_null($forcedVariations) && isset($forcedVariations[$userId])) {
346346
$variationKey = $forcedVariations[$userId];
347347
$variation = $this->_projectConfig->getVariationFromKey($experiment->getKey(), $variationKey);
348-
if ($variationKey) {
348+
if ($variationKey && !empty($variation->getKey())) {
349349
$this->_logger->log(
350350
Logger::INFO,
351351
sprintf('User "%s" is forced in variation "%s" of experiment "%s".', $userId, $variationKey, $experiment->getKey())
352352
);
353+
} else {
354+
return null;
353355
}
354356
return $variation;
355357
}

0 commit comments

Comments
 (0)