[wp-trac] [WordPress Trac] #17689: Terms should not be sanitized inside term_exists()
    WordPress Trac 
    noreply at wordpress.org
       
    Thu Jan 10 02:18:48 UTC 2013
    
    
  
#17689: Terms should not be sanitized inside term_exists()
----------------------------------------+------------------
 Reporter:  blepoxp                     |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  3.6
Component:  Taxonomy                    |     Version:  3.2
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |
----------------------------------------+------------------
Comment (by wonderboymusic):
 I just attached a file that shows the results of some tests I was running.
 {{{
 $slugs = array();
 for ( $i = 33; $i < 256; $i++ ) {
         $char = trim( mb_convert_encoding('&#' . intval($i) . ';',
 'UTF-8', 'HTML-ENTITIES' ) );
         echo $char, PHP_EOL;
         echo sanitize_title_with_dashes( 'A' . $char ), PHP_EOL;
         $ids = wp_insert_term( 'A' . $char, 'post_tag' );
         $term = get_term( $ids['term_id'], 'post_tag' );
         if ( in_array( $term->slug, $slugs ) )
                 exit( 'NOOOOOOOO!' );
         else
                 $slugs[] = $term->slug;
         echo $term->slug, PHP_EOL, PHP_EOL;
 }
 exit();
 }}}
 Prints out the following:
 - The char
 - The result of passing `'A' . $char` to `sanitize_title_with_dashes()`
 - The resulting slug
 `'A' . $char` produces many dupes. All term slugs are unique.
-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17689#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
    
    
More information about the wp-trac
mailing list