[wp-trac] [WordPress Trac] #5661: url_to_postid sometimes incorrectly doubles requested url

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 14 03:45:56 GMT 2008

#5661: url_to_postid sometimes incorrectly doubles requested url
 Reporter:  filosofo  |       Owner:  anonymous                         
     Type:  defect    |      Status:  new                               
 Priority:  normal    |   Milestone:  2.5                               
Component:  General   |     Version:  2.5                               
 Severity:  normal    |    Keywords:  url_to_postid wp_rewrite has-patch
 This patch brings url_to_postid into line with the same rewrite rule-
 matching behavior as that in the parse_request method of WP.

 To understand the problem---which has already been fixed in the
 parse_query method---suppose you have a page with the name {{{blog

 Among others, you have the following two rewrite rules:[[br]]

 The problem is that {{{( (! empty($url)) && (strpos($match, $url) === 0)
 )}}} returns true on the first rewrite rule, where $match is the rule and
 $url is {{{blog/comments-preview}}}, so $request_match becomes {{{blog
 /comments-preview/blog/comments-preview}}} instead of what it should stay
 as: {{{blog/comments-preview}}}

 So when the foreach loop reaches the correctly matching rule, the second
 one above, it no longer matches, and url_to_postid returns false.

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

More information about the wp-trac mailing list