[wp-trac] [WordPress Trac] #36827: Regular expression in wp_guess_url() is slightly too permissive.

WordPress Trac noreply at wordpress.org
Tue Sep 13 19:49:00 UTC 2022


#36827: Regular expression in wp_guess_url() is slightly too permissive.
-------------------------------------------------+-------------------------
 Reporter:  cfinke                               |       Owner:
                                                 |  davidbaumwald
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  General                              |     Version:  3.4
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch good-first-bug has-unit-   |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by davidbaumwald):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54146" 54146]:
 {{{
 #!CommitTicketReference repository="" revision="54146"
 General: Correct path replacement regex in `wp_guess_url`.

 In `wp_guess_url`, the regex to check for wp-login.php in the URL is
 slightly too permissive, not escaping `.` in "wp-login.php".  `.` is a
 token in regex that matches any character.

 This change simply escapes the `.` and adds unit test coverage for
 `wp_guess_url`.

 Props cfinke, ocean90, jrf, voldemortensen, jdgrimes, curdin, netweb,
 petitphp, SergeyBiryukov, costdev.
 Fixes #36827.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/36827#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list