Ticket #20462: 20462.diff

File 20462.diff, 964 bytes (added by scribu, 13 months ago)
Line 
1diff --git wp-includes/post.php wp-includes/post.php
2index 8e8a387..e3a6f21 100644
3--- wp-includes/post.php
4+++ wp-includes/post.php
5@@ -2687,11 +2687,12 @@ function wp_update_post($postarr = array()) {
6        $post = add_magic_quotes($post);
7 
8        // Passed post category list overwrites existing category list if not empty.
9-       if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
10-                        && 0 != count($postarr['post_category']) )
11+       if ( isset( $postarr['post_category'] ) && is_array( $postarr['post_category'] ) && !empty( $postarr['post_category'] ) )
12                $post_cats = $postarr['post_category'];
13-       else
14+       elseif( isset( $post['post_category'] ) )
15                $post_cats = $post['post_category'];
16+       else
17+               $post_cats = array();
18 
19        // Drafts shouldn't be assigned a date unless explicitly done so by the user
20        if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&