Report error(E_WARNING) when using scalar as array

This fix is related to #65484 #37676 #40692 #62769