Handle PHP ArrayObject case more gracefully