[wp-trac] [WordPress Trac] #12271: Using # in permalinks breaks preg_match in parse_request

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 18 09:32:26 UTC 2010


#12271: Using # in permalinks breaks preg_match in parse_request
--------------------------+-------------------------------------------------
 Reporter:  timsogard     |       Owner:  ryan      
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  Permalinks    |     Version:  2.9.2     
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------

Comment(by nacin):

 The bug here is that WordPress is allowing you to include an anchor in
 your permastruct.

 The permalink structures are used in two places: to generate links, and to
 generate rewrite rules. To do what you're trying to do, you'd need to
 sever them. (Why in a moment.) The best way to sever them I think would be
 to use a typical permastruct (i.e. without /#/) and then use filters to
 modify the links to use /#/. The latter could also be done via a JS bind
 (it really all depends how you are planning out your AJAX architecture).

 Now, here's why you have to sever them. URI fragments are handled browser-
 side. They are never passed to the server. If this change was made, you'd
 see that no rewrite rules would ever match, as WP would literally see no
 URL. Via ajax you have to send a sound request to WP, but you're probably
 not getting that far due to the error. Of course, your AJAX application
 could already be set up to pass WP the right string.

 My point is, try to think of the permalink structure as what generates the
 rewrite rules, not the links, then fix the links. The other way around
 doesn't really apply because rewrite rules should never expect an anchor.

 So it sounds like we should be fixing options-permalink.php to reject
 anchors in structures. (Again, think rewriting, not links.)

 Does that sound right, or have I not thought this through entirely? (More
 coffee?)

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


More information about the wp-trac mailing list