[wp-trac] [WordPress Trac] #16282: PHP catchable error with get_term_link and WP3.1RC2

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 25 23:30:13 UTC 2011


#16282: PHP catchable error with get_term_link and WP3.1RC2
------------------------------+-----------------------
 Reporter:  illutic           |       Owner:
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:  3.1
Component:  Multisite         |     Version:  3.1
 Severity:  major             |  Resolution:
 Keywords:  has-patch commit  |
------------------------------+-----------------------

Comment (by dd32):

 I'm of the mind that we should use sanitize_title() still, It's how the
 slugs are currently sanitized.

 We '''cannot''' retain 100% backwards compatibility here for
 `get_term_by('slug'`, take this for example:
 {{{
 var_dump( get_term_by('slug', 'ńaș', 'category') );
 }}}

 Using `sanitize_title()`, if it's created in 3.1, it'll be accessible (the
 slug is 'nas'). Using `sanitize_title_for_query()` it'll be inaccessible
 (it makes the slug '%c5%84a%c8%99').

 Lets take that same term created in 3.0 however, and request it using
 'ńaș'
  * using sanitize_title() will fail ('nas')
  * using sanitize_title_for_query() will fail ('%c5%84a%c8%99')

 Reason being, the slug in 3.0 is: na%c8%99 (The n is converted, the s
 isnt)

 So ultimately, the exact slug will have to be requested, You cant use
 either one or the other, It needs to stay with the current sanitization
 functions employed by core.

 As for changing get_term_link() to accept a name instead, Seems like the
 "best" bet here, But thats an enhancement over core functionality, Anyone
 relying on that is ultimately relying on a bug/feature that was never
 supposed to be.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16282#comment:52>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list