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

WordPress Trac noreply at wordpress.org
Thu Jul 28 01:53:53 UTC 2022

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

Comment (by SergeyBiryukov):

 Thanks for the patch! [attachment:"36827.patch"] looks OK to me in
 general, though it could use some cleanup:
 * Changing [https://make.wordpress.org/core/handbook/testing/automated-
 testing/writing-phpunit-tests/#test-methods camelCase to snake_case] and
 resolving WPCS issues.
 * Moving the test to a better place, as `tests/includes/helpers.php` is
 only meant for some helper functions from the test suite itself.

 As we don't have a dedicated test file for `wp_guess_url()` yet, and it's
 located in `wp-includes/functions.php`, the test should probably be
 somewhere in
 tests/functions.php], perhaps after the `validate_file()` test. Or we
 could create a new file and add some more tests :)

 Testing the patch with all the cases mentioned above would be very
 welcome! Are they all included in the unit test?

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

More information about the wp-trac mailing list