WordPress.org

Make WordPress Core

Ticket #10126: 10126.patch

File 10126.patch, 1.1 KB (added by hakre, 4 years ago)

updated fix against current trunk incl. a fixme mark

  • wp-includes/post.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    19771977        } elseif ( in_array($post_type, $hierarchical_post_types) ) { 
    19781978                // Page slugs must be unique within their own trees.  Pages are in a 
    19791979                // separate namespace than posts so page slugs are allowed to overlap post slugs. 
    1980                 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", esc_sql($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; 
     1980                // FIXME $wpdb->prepare usage for $hierarchical_post_types as well 
     1981                $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", array_map('esc_sql', $hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; 
    19811982                $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent)); 
    19821983 
    19831984                if ( $post_name_check || in_array($slug, $feeds) ) {