adding the (string)0 to the cast value check
adding check for register_long_arrays setting (recommend off)