Skip to content

Commit

Permalink
Fix AB switcher cookie value issue
Browse files Browse the repository at this point in the history
  • Loading branch information
systream committed May 8, 2016
1 parent 50d8b82 commit 97877e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/FeatureSwitch/Feature/Switcher/AB.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function isEnabled(FeatureInterface $feature)
$cookieResult = $this->getRandomState();
$cookieWrapper->set($featureCookieKey, $cookieResult, self::EXPIRE);
}
return $cookieResult;
return filter_var($cookieResult, FILTER_VALIDATE_BOOLEAN);
}

/**
Expand All @@ -39,7 +39,8 @@ protected function getRandomState()
{
$state = $this->lastState === null ? $this->getRandomStateByMicroTime() : !$this->lastState;
$this->lastState = $state;
return $state;

return $state ? 'TRUE' : 'FALSE';

}

Expand Down

0 comments on commit 97877e8

Please sign in to comment.