It took me a long time to determine what was causing so many errors in my script. I have condensed it down into the example below. When using the #NoEnv option, this script shows a warning on the arr2 line. Interestingly, if I comment out the line for arr1, there is no warning. Also, if I comment out the #NoEnv line, the warning is not displayed.

If this is not a bug, could someone please help me to understand why this is happening?