In `wp_create_post_autosave()`, intersect the `$new_autosave`'s keys with the keys from `_wp_post_revision_fields()` to ensure that all expected fields are present.

Props kovshenin.
Fixes #25416.


Built from https://develop.svn.wordpress.org/trunk@27690


git-svn-id: http://core.svn.wordpress.org/trunk@27529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-03-24 20:32:14 +00:00
parent 0115ba2f30
commit 4eadc109f8
1 changed files with 1 additions and 1 deletions

View File

@ -1468,7 +1468,7 @@ function wp_create_post_autosave( $post_data ) {
// If the new autosave has the same content as the post, delete the autosave.
$post = get_post( $post_id );
$autosave_is_different = false;
foreach ( array_keys( _wp_post_revision_fields() ) as $field ) {
foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields() ) ) as $field ) {
if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
$autosave_is_different = true;
break;