[wp-trac] [WordPress Trac] #20560: url_to_postid() string matching is not strict enough, can lead to incorrect results

WordPress Trac noreply at wordpress.org
Sun Aug 18 01:58:28 UTC 2013


#20560: url_to_postid() string matching is not strict enough, can lead to incorrect
results
-------------------------------------+------------------
 Reporter:  gradyetc                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  3.7
Component:  Query                    |     Version:  3.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------

Comment (by gcorne):

 Nacin's suggestion that only the {{{if ( false !== strpos($url,
 home_url()) )}}}} condition needed to be modified to address the issue was
 correct, but as I was looking more closely at the logic, I noticed that
 there were a couple related problems with how a server-relative url is
 handled. The additional cases are illustrated in the refreshed set of unit
 tests in
 [https://core.trac.wordpress.org/attachment/ticket/20560/rewrite.php
 rewrite.php] and addressed in
 [https://core.trac.wordpress.org/attachment/ticket/20560/20560.3.patch
 20560.3.patch].

 I also am pretty sure that the condition {{{ if ( !empty($url) && ($url !=
 $request) && (strpos($match, $url) === 0) )}}} later on will never return
 true so it and the subsequent statement is unnecessary.

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


More information about the wp-trac mailing list