Opened 2 years ago
Closed 21 months ago
#17754 closed enhancement (fixed)
preg_match() use is overkill in path_is_absolute()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3 |
| Component: | Performance | Version: | 3.1.4 |
| Severity: | minor | Keywords: | has-patch |
| Cc: |
Description
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).
Attachments (2)
Change History (6)
coffee2code — 2 years ago
comment:2
coffee2code — 2 years ago
Ah, missed that convention. Thanks! Revised patch, 17754.2.diff, attached.
Note: See
TracTickets for help on using
tickets.

Like the patch, but our coding standards (or at least standard usage) are for array style access to characters i.e. $str[0]. See #13900.