[TYPO3-core] RFC: #2302: substitute all strtoupper/strtolower with the t3lib_div-method
Dmitry Dulepov [typo3]
dmitry at typo3.org
Fri Jun 27 18:02:32 CEST 2008
Hi!
Steffen Kamper wrote:
> I agree that there are cases where it's not necessary. Anyway there where
> like 500 cases where it's used, so it's not simple to decide where it's not
> needed.
> Any suggestion how to deal that? I could restart replacement and split it
> "by file" which means also that there will be 30-50 single requests which
> doesn't make it more easy.
I don't think splitting by file will help...
The following case should not use t3lib_div:
- "if (strtolower($var) == 'abc')" when you compare to a pure ascii value ('true', 'gif', 'png', etc)
The following cases should use t3lib_div:
- if (strtolower($var1) == strtolower($var2))
- $var2 = strtolower($var2);
The difference: if code is only trying to find if value matches or not (result is "yes/no"), there is no need for t3lib_div. However if code is *using* the result of strtolower (not the result of comparison but result of the function itself!), the t3lib_div is necessary.
--
Dmitry Dulepov
http://typo3bloke.net/
More information about the TYPO3-team-core
mailing list