Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 14 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:

Description

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 15 years ago.

Download all attachments as: .zip

Change History (8)

@nacin
15 years ago

#1 @nacin
15 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
15 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
15 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:

admin-ajax.php
wp-admin/includes/media.php
wp-admin/includes/class-wp-filesystem-ftpext.php
wp-includes/general-template.php
wp-includes/vars.php

Omitted from patch:
wp-admin/load-scripts.php
wp-admin/load-styles.php
wp-includes/js/tinymce/wp-tinymce.php
wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php

#4 @hakre
15 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
15 years ago

@hakre: stripos also is in compat.php

#6 @nacin
15 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.