Additionally, cast $value explicitly to string if it's not an array to avoid additional errors
Closes #3498791
For some reason the patch resulting from merge request !26 failed to apply (despite updating the fork from the 2.0.x branch), so hoping this merge request will work instead.