[wp-trac] [WordPress Trac] #33118: Don't assume the $post is an array in sanitize_post().
WordPress Trac
noreply at wordpress.org
Sat Jul 25 03:26:33 UTC 2015
#33118: Don't assume the $post is an array in sanitize_post().
--------------------------+-----------------------------
Reporter: morganestes | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 2.5
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
`sanitize_post()` expects `$post` to be an object (`OBJECT`|WP_Post) or an
array (`ARRAY_A`|`ARRAY_N`), and returns the same type, but only checks
for `is_object()`, then assumes it's an array and iterates over it as one
without further checking.
It may be a bit overkill, but explicitly checking for `is_array()` seems
like the right thing to do to avoid potential errors thrown by trying to
use `array_keys()` over a non-array.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33118>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list