Make WordPress Core

Changeset 37137


Ignore:
Timestamp:
03/30/2016 05:28:55 PM (6 years ago)
Author:
nbachiyski
Message:

Taxonomies: make sure taxonomy functions work correctly with taxonomy names with special characters

The codex says that taxonomy names "should only contain lowercase letters and the underscore character", but that's not enforced. It's too late to enforce it, since some plugins haven't been following it and the official phpdoc doesn't mention this restriction.

Merge of [37133] to the 4.2 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/src/wp-includes/taxonomy.php

    r32426 r37137  
    603603    $term_ids = array_map('intval', $term_ids );
    604604
    605     $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
     605    $taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    606606    $term_ids = "'" . implode( "', '", $term_ids ) . "'";
    607607
     
    17771777    }
    17781778
    1779     $where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
     1779    $where = "tt.taxonomy IN ('" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
    17801780
    17811781    $exclude = $args['exclude'];
     
    27032703    $taxonomy_array = $taxonomies;
    27042704    $object_id_array = $object_ids;
    2705     $taxonomies = "'" . implode("', '", $taxonomies) . "'";
     2705    $taxonomies = "'" . implode("', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
    27062706    $object_ids = implode(', ', $object_ids);
    27072707
Note: See TracChangeset for help on using the changeset viewer.