Skip to content

Commit 144813d

Browse files
drieschelImmanuel Klinkenberg
authored and
Immanuel Klinkenberg
committed
fix: avoid deprecation notices when passing null to strlen
1 parent afd9b90 commit 144813d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ public function getForcedVariation(ProjectConfigInterface $projectConfig, $exper
510510
$experimentId = $projectConfig->getExperimentFromKey($experimentKey)->getId();
511511

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

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

572572
// check if the variation exists in the datafile (a new variation is returned if it is not in the datafile)
573-
if (strlen($variationId) == 0) {
573+
if (strlen((string)$variationId) == 0) {
574574
// this case is logged in getVariationFromKey
575575
return false;
576576
}

0 commit comments

Comments
 (0)