Skip to content

Commit e1e0d90

Browse files
committed
Changed findValueInArray to return false instead of null, updated
oldToNewDescriptionItem to reflect change in return value.
1 parent 211368a commit e1e0d90

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ToolkitApi/CW/cwclasses.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ public function splitPcmlProgramPath($path)
585585
* and return the value associated with the key name provided.
586586
*
587587
* @param string $searchKey key to search for
588-
* @return string|array|null value found in input array for array key. null if failed
588+
* @return string|array|false value found in input array for array key. false if failed
589589
*/
590590
protected function findValueInArray($searchKey, $valueArray)
591591
{
@@ -594,7 +594,7 @@ protected function findValueInArray($searchKey, $valueArray)
594594
// ensure that array is not empty
595595
if (!count($valueArray)) {
596596
i5ErrorActivity(I5_ERR_PHP_TYPEPARAM, I5_CAT_PHP, "Array of input values must not be empty", "Array of input values must not be empty");
597-
return null;
597+
return false;
598598
}
599599

600600
foreach ($valueArray as $key=>$value) {
@@ -608,7 +608,7 @@ protected function findValueInArray($searchKey, $valueArray)
608608

609609
// if failed, return null
610610
// $connection->logThis("findValueInArray: searchKey: $searchKey. no value found");
611-
return null;
611+
return false;
612612
}
613613

614614
/**
@@ -778,9 +778,9 @@ protected function oldToNewDescriptionItem($oldDataDescription = array(), $input
778778
// Look up its value (could be another data structure or a single value)
779779
// in the input array, based on data structure name.
780780
$dsData = $this->findValueInArray($dsName, $inputValues);
781-
// Compare with null since this is what findValueInArray returns on error
781+
// Compare with false since this is what findValueInArray returns on error
782782
// this will prevent things such as empty arrays from causing errors
783-
if ($dsData === null) {
783+
if ($dsData === false) {
784784
// ds has no description to match value!
785785
i5ErrorActivity(I5_ERR_PARAMNOTFOUND, I5_CAT_PHP, "Requested parameter '$dsName' does not exist in the input data", "Requested parameter $dsName does not exist in the input data");
786786
return false;

0 commit comments

Comments
 (0)