Ensure we don't mangle the array of post ancestors when sanitising a post for editing. Fixes #12168.

git-svn-id: https://develop.svn.wordpress.org/trunk@13016 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2010-02-07 21:49:00 +00:00
parent 77e592fead
commit 06d6e8e094
1 changed files with 7 additions and 1 deletions

View File

@ -1199,7 +1199,6 @@ function sanitize_post($post, $context = 'display') {
$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
$post['filter'] = $context;
}
return $post;
}
@ -1235,6 +1234,13 @@ function sanitize_post_field($field, $value, $post_id, $context) {
if ( in_array($field, $int_fields) )
$value = (int) $value;
// Fields which contain arrays of ints.
$array_int_fields = array( 'ancestors' );
if ( in_array($field, $array_int_fields) ) {
$value = array_map( 'absint', $value);
return $value;
}
if ( 'raw' == $context )
return $value;