Fix an error in SQL generation when `perm` is set and an array is passed for `post_status`. Adds unit test.

Props oso96_2000.
Fixes #25523.



git-svn-id: https://develop.svn.wordpress.org/trunk@27067 602fd350-edb4-49c9-b593-d223f7449a82