From ef549c1699d12e3fac09b02ecdfe94fc8cbf7756 Mon Sep 17 00:00:00 2001 From: danloa Date: Fri, 16 Feb 2024 14:47:01 -0400 Subject: [PATCH] Verify for null values and index existence --- ProcessMaker/Models/ProcessRequestToken.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ProcessMaker/Models/ProcessRequestToken.php b/ProcessMaker/Models/ProcessRequestToken.php index c9ceb6674a..37c7fd65ca 100644 --- a/ProcessMaker/Models/ProcessRequestToken.php +++ b/ProcessMaker/Models/ProcessRequestToken.php @@ -1045,8 +1045,12 @@ public function getLoopContext() if (!$isMultiInstance) { return ''; } - $loopData = $this->token_properties['data']; - $index = $loopData['loopCounter']; + $loopData = $this->token_properties['data'] ?? []; + + $index = null; + if (array_key_exists('loopCounter', $loopData)) { + $index = $loopData['loopCounter']; + } $definition = $this->getDefinition(true); if (!$definition instanceof ActivityInterface) { return ''; @@ -1059,7 +1063,7 @@ public function getLoopContext() return ''; } - return $variable . '.' . $index; + return $index !== null ? $variable . '.' . $index : $variable; } /**