Skip to content
Snippets Groups Projects
Commit 0a761995 authored by Jo Hasenau's avatar Jo Hasenau Committed by Markus Klein
Browse files

[TASK] Replace all strcmp() calls with ===

This patch replaces about 300 places using strcmp()
in the whole core. There are different contexts for strcmp()
within this set, i.e. checking for strings being '0',
'', not '' and the like.

strcmp() has to stay when it comes to real sorting of strings,
which is a rather rare case, otherwise it can be replaced with
faster alternatives.

The following 'rules' were used for the replacement:

* Use a type cast if you can't be sure about the incoming values.
  We do not need type casts if the types are implicitly defined
  before by another function. i.e. intval(), trim(), substr()
* Use int-cast whenever the values to be compared are numbers only.
* Use string-cast for any other combination. i.e
  (string)$len === '0' when $len can be NULL, which is different
  to (int)$len === 0

Resolves: #54085
Releases: 6.2
Change-Id: I88fb294ae20d8c23ff58d8296fbb37925d5213c8
Reviewed-on: https://review.typo3.org/25843
Reviewed-by: Markus Klein
Tested-by: Markus Klein
parent c9651784
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment