Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#11176 closed enhancement (fixed)

Convert strpos/strtolower to stripos

Reported by: nacin's profile nacin Owned by:
Milestone: 3.0 Priority: lowest
Severity: trivial Version: 2.9
Component: Performance Keywords: has-patch
Focuses: Cc:


A quick grep shows the core using 18 instances of strpos and strto(low|upp)er in tandem. Most if not all can be converted to stripos.

Attachments (1)

11176.diff (3.9 KB) - added by nacin 14 years ago.

Download all attachments as: .zip

Change History (8)

14 years ago

#1 @nacin
14 years ago

  • Keywords has-patch added
  • Milestone changed from Future Release to 3.0
  • Priority changed from normal to lowest
  • Severity changed from normal to trivial

#2 @Denis-de-Bernardy
14 years ago

@nacin: haven't tested, but did you make sure that the compat functions were loaded in each of those files? if they're not, we'd break php 4 installs.

#3 @nacin
14 years ago

  • Type changed from defect (bug) to enhancement

Yes, the ones patched should be good. Here are the files that use strpos + strtolower included in the patch:


Omitted from patch:

#4 @hakre
14 years ago

For the log: stripos is available since PHP 5. Most of the hosts will benefit from this change. Nice find.

#5 @Denis-de-Bernardy
14 years ago

@hakre: stripos also is in compat.php

#6 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [13132]) Use stripos() instead of strpos() with strtolower(). For PHP < 5 we have stripos() in compat.php. Fixes #11176

Note: See TracTickets for help on using tickets.