[wp-trac] [WordPress Trac] #56922: Template / Template parts revision / autosave REST API are broken
WordPress Trac
noreply at wordpress.org
Tue Oct 10 11:26:07 UTC 2023
#56922: Template / Template parts revision / autosave REST API are broken
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.4
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses: rest-api
testing changes-requested |
-------------------------------------------------+-------------------------
Comment (by antonvlasenko):
> In summary, I don't think any of the things you documented are an issue,
they are how it meant to work,
Thank you for the detailed reply, @spacedmonkey . I've read your response
attentively and I agree with your explanation of how things are meant to
work. However, that's not exatly the point I'm trying to make.
Please take a look at this PHP snippet: https://3v4l.org/FqcJD,
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.
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.
I've added these changes as code review suggestions for your
consideration.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56922#comment:38>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list