Skip to content

Commit

Permalink
Whitelisted variation should continue when no valid variation is found.
Browse files Browse the repository at this point in the history
  • Loading branch information
msohailhussain committed Aug 21, 2018
1 parent 3280346 commit fbc279f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Optimizely/DecisionService/DecisionService.php
Expand Up @@ -345,11 +345,13 @@ private function getWhitelistedVariation(Experiment $experiment, $userId)
if (!is_null($forcedVariations) && isset($forcedVariations[$userId])) {
$variationKey = $forcedVariations[$userId];
$variation = $this->_projectConfig->getVariationFromKey($experiment->getKey(), $variationKey);
if ($variationKey) {
if ($variationKey && !empty($variation->getKey())) {
$this->_logger->log(
Logger::INFO,
sprintf('User "%s" is forced in variation "%s" of experiment "%s".', $userId, $variationKey, $experiment->getKey())
);
} else {
return null;
}
return $variation;
}
Expand Down

0 comments on commit fbc279f

Please sign in to comment.