[wp-trac] [WordPress Trac] #48530: Match REST API route by namespace before performing regex checks
WordPress Trac
noreply at wordpress.org
Wed Feb 19 21:55:04 UTC 2020
#48530: Match REST API route by namespace before performing regex checks
--------------------------------------+--------------------------
Reporter: TimothyBlynJacobs | Owner: kadamwhite
Type: enhancement | Status: reopened
Priority: normal | Milestone: 5.4
Component: REST API | Version: 4.4
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+--------------------------
Comment (by TimothyBlynJacobs):
This is a great catch, thanks @davidbinda! We should definitely fix this.
I made a small change to your patch so we don't call `array_merge` in a
loop (
[https://github.com/kalessil/phpinspectionsea/blob/master/docs/performance.md
#slow-array-function-used-in-loop info] ).
As well as more accurately testing that it is a namespace match by adding
a trailing slash in the comparison.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48530#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list