Announcement

Collapse
No announcement yet.

Seems a couple of bugs managing arrays

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Seems a couple of bugs managing arrays

    I think I found a couple of bugs managing the arrays. But if I misunderstood something, please advice.


    If in a script task I write the following:

    $testList = list();
    $testList = list('aaa','bbb','ccc');
    $testListTxt = array\join($testList, ",");
    $testListTotal = string\length($testList);


    I would expect the following values

    $testListTxt: aaa,bbb,ccc And that is what I obtained. OK
    $testListTotal; 3 But I obtain 5!!! This if the first bug

    Then if I add the following code

    $testToFind1 ='ccc';
    $testToFindIndex1 = array\indexOf($testList, $testToFind1);

    ifThenElse($testToFindIndex1 == null,
    $testOutput1 = 'Not Found',
    $testOutput1 = 'Found');


    Both values resulted as expected. OK
    $testToFindIndex1: 2
    $testOutput1: Found

    But if I do the same with a nonexistent value :

    $testToFind2 ='abc';
    $testToFindIndex2 = array\indexOf($testList, $testToFind2);

    ifThenElse($testToFindIndex2 == null,
    $testOutput2 = 'Not Found',
    $testOutput2 = 'Found');


    Result values are not as expected.
    $testToFindIndex1: Seems correct as I was expecting null, but something different was obtained looking at the next value, so this is the second bug.
    $testOutput1: Found Here I was expecting 'Not Found'


  • #2
    I found the first bug is not and is a mistake on my side.

    Changed to this, and works correctly

    $testList = list();
    $testList = list('aaa','bbb','ccc');
    $testListTxt = array\join($testList, ",");
    $testListTotal = array\length($testList);


    But remains the second bug (or mistake)

    Comment


    • #3
      It returns false. I will fix to return null according docs.

      Comment


      • #4
        Thanks

        Comment

        Working...
        X