[wp-trac] [WordPress Trac] #17754: preg_match() use is overkill in path_is_absolute()

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 10 18:11:11 UTC 2011


#17754: preg_match() use is overkill in path_is_absolute()
-------------------------+-----------------------------
 Reporter:  coffee2code  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Performance  |    Version:  3.1.4
 Severity:  minor        |   Keywords:  has-patch
-------------------------+-----------------------------
 `path_is_absolute()` utilizes `preg_match()` to check if the first
 character of a path string is either of two possibilities.  This is way
 overkill for such a simple case.  The alternative I've proposed via the
 attached patch is more performant and makes the intention of the code
 clearer (rather than obscured in a regular expression).

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17754>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list