Review main Abandoned

26732[TASK] Use isFirstPartOfString instead of string functions

Jo Hasenau CR 0 V 0 Normal +71 −64 updated 01/31/15, 14:03

Commit message

This patch replaces some of a few hundred occurrences of
strpos() and substr() in the whole core.

It currently is the first patchset that concentrated on
strpos() - more will follow.

The major goal is to use isFirstPartOfString when it makes
sense, maybe introduce isLastPartOfString, if this can
increase performance, and sometimes replace the string functions
used with array functions instead, i.e. when the combination
of substr and strpos simulates an actual explode.

After that we can test isFirstPartOfString in just one place
and improve it if necessary

The following 'rules' were used for the replacement:
* Use isFirstPartOfString for any occurence of
  strpos(haystack, needle) === 0
  strpos(haystack, needle, 0) === 0
* Use isFirstPartOfString for any occurence of
  substr(haystack, 0, strlen(needle)) === needle
* Use variable{x} for any occurence of
  substr(string, x, 1)
* Use array methods, when the string methods are simulating
  an explode

Review

  • Code review CR 0

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V 0

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 34

Show 14 more files