$upper is not a true or false identifier, it merely turns your string into its uppercase equivalent.

//echo -a $upper(foo5) == FOO5

Similarly, and consistently:

//echo -a $upper(5) == 5

This is correct and intentional behaviour.