Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #56922, comment 38


Ignore:
Timestamp:
10/10/2023 12:19:50 PM (3 years ago)
Author:
antonvlasenko

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #56922, comment 38

    v1 v2  
    55Please take a look at this PHP snippet: https://3v4l.org/Vp3Xb, specifically at its output at the very bottom of the page. Notice how the `$current_regular_expression` matches IDs that shouldn't be matched. Conversely, `$fixed_regular_expression` works as intended, not matching the incorrect IDs.
    66
    7 To fix the issue, `(?:\/[^\/:<>\*\?"\|]+)?` should be replaced with `\/[^\/:<>\*\?"\|]+` in all regular expressions defining the routes in the new controllers, because the group that matches the template ID (`post_name`) part of the ID should not be optional.
     7To fix the issue, `(?:\/[^\/:<>\*\?"\|]+)?` should be replaced with `\/\/?[^\/:<>\*\?"\|]+` in all regular expressions defining the routes in the new controllers, because the group that matches the template ID (`post_name`) part of the ID should not be optional.
    88I've added these changes as code review suggestions for your consideration.