how about doing the check here, with an if-else-if, doing a if(is_string(...)) ? and then on the final else, just log a warning?