Make WordPress Core

Ticket #33929: 33929.patch

File 33929.patch, 5.9 KB (added by tfrommen, 10 years ago)
  • wp-includes/ms-functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>windows-1252
     
    374374        elseif ( $id )
    375375                return (int) $id;
    376376
    377         $id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
     377        $id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
    378378
    379379        if ( ! $id ) {
    380380                wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );
     
    13211321function domain_exists($domain, $path, $site_id = 1) {
    13221322        global $wpdb;
    13231323        $path = trailingslashit( $path );
    1324         $result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
     1324        $result = (int) $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
    13251325
    13261326        /**
    13271327         * Filter whether a blogname is taken.
     
    13331333         * @param string   $path    Path to be checked.
    13341334         * @param int      $site_id Site ID. Relevant only on multi-network installs.
    13351335         */
    1336         return apply_filters( 'domain_exists', $result, $domain, $path, $site_id );
     1336        return (int) apply_filters( 'domain_exists', $result, $domain, $path, $site_id );
    13371337}
    13381338
    13391339/**
     
    18631863        $term_id = intval( $term_id );
    18641864        $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );
    18651865
    1866         $global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
    1867         if ( $global_id == null ) {
     1866        $global_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
     1867        if ( $global_id === 0 ) {
    18681868                $used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );
    18691869                if ( null == $used_global_id ) {
    18701870                        $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
     
    18781878                        $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
    18791879                        $global_id = $wpdb->insert_id;
    18801880                }
    1881         } elseif ( $global_id != $term_id ) {
     1881        } elseif ( $global_id !== $term_id ) {
    18821882                $local_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );
    18831883                if ( null != $local_id ) {
    18841884                        global_terms( $local_id );
  • wp-includes/user-functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>windows-1252
     
    271271
    272272        $where = get_posts_by_author_sql( $post_type, true, $userid, $public_only );
    273273
    274         $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
     274        $count = (int) $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
    275275
    276276        /**
    277277         * Filter the number of posts a user has written.
     
    285285         * @param string|array $post_type   Single post type or array of post types to count the number of posts for.
    286286         * @param bool         $public_only Whether to limit counted posts to public posts.
    287287         */
    288         return apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );
     288        return (int) apply_filters( 'get_usernumposts', $count, $userid, $post_type, $public_only );
    289289}
    290290
    291291/**
  • wp-includes/ms-blogs.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>windows-1252
     
    9191                $path = $current_site->path . $slug . '/';
    9292        }
    9393
    94         $blog_id = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $domain, $path) );
     94        $blog_id = (int) $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE domain = %s AND path = %s", $domain, $path) );
    9595        wp_cache_set( 'get_id_from_blogname_' . $slug, $blog_id, 'blog-details' );
    9696        return $blog_id;
    9797}
  • wp-includes/class-wp-user-query.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>windows-1252
     
    437437                 * @param string $sql The SELECT FOUND_ROWS() query for the current WP_User_Query.
    438438                 */
    439439                if ( isset( $qv['count_total'] ) && $qv['count_total'] )
    440                         $this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
     440                        $this->total_users = (int) $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
    441441
    442442                if ( !$this->results )
    443443                        return;
  • wp-includes/media.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>windows-1252
     
    34763476                "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s",
    34773477                $path
    34783478        );
    3479         $post_id = $wpdb->get_var( $sql );
     3479        $post_id = (int) $wpdb->get_var( $sql );
    34803480
    34813481        /**
    34823482         * Filter an attachment id found by URL.