Skip to content

Commit

Permalink
fix: avoid deprecation notices when passing null to strlen
Browse files Browse the repository at this point in the history
  • Loading branch information
drieschel authored and Immanuel Klinkenberg committed Aug 29, 2022
1 parent afd9b90 commit 144813d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Optimizely/DecisionService/DecisionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public function getForcedVariation(ProjectConfigInterface $projectConfig, $exper
$experimentId = $projectConfig->getExperimentFromKey($experimentKey)->getId();

// check for null and empty string experiment ID
if (strlen($experimentId) == 0) {
if (strlen((string)$experimentId) == 0) {
// this case is logged in getExperimentFromKey
return [ null, $decideReasons];
}
Expand Down Expand Up @@ -554,7 +554,7 @@ public function setForcedVariation(ProjectConfigInterface $projectConfig, $exper
$experimentId = $experiment->getId();

// check if the experiment exists in the datafile (a new experiment is returned if it is not in the datafile)
if (strlen($experimentId) == 0) {
if (strlen((string)$experimentId) == 0) {
// this case is logged in getExperimentFromKey
return false;
}
Expand All @@ -570,7 +570,7 @@ public function setForcedVariation(ProjectConfigInterface $projectConfig, $exper
$variationId = $variation->getId();

// check if the variation exists in the datafile (a new variation is returned if it is not in the datafile)
if (strlen($variationId) == 0) {
if (strlen((string)$variationId) == 0) {
// this case is logged in getVariationFromKey
return false;
}
Expand Down

0 comments on commit 144813d

Please sign in to comment.