[wp-trac] [WordPress Trac] #21213: Underscores get stripped out in $type ( get_query_template() )

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 11 05:29:38 UTC 2012


#21213: Underscores get stripped out in $type ( get_query_template() )
--------------------------+-------------------------------------
 Reporter:  rinatkhaziev  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Template      |    Version:  3.4.1
 Severity:  normal        |   Keywords:  needs-testing has-patch
--------------------------+-------------------------------------
 What happens is:

 {{{
 $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
 }}}

 strips underscore. Effectively, incoming "front_page" becomes frontpage,
 which leads to not working (but documented) hook front_page_template.

 I tested this on: nginx 1.2.1/php-fpm 5.4.3 (homebrew macos) and nginx 1.0
 /php-fpm 5.3.3 with the latest revision ATM

 The fix is as simple as
 {{{
 $type = preg_replace( '|[^a-z0-9-_]+|', '', $type );
 }}}

 Patch is attached.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21213>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list