[TYPO3-core] RFC: #2302: substitute all strtoupper/strtolower with the t3lib_div-method
Steffen Kamper
steffen at sk-typo3.de
Fri Jun 27 18:15:28 CEST 2008
Hi,
"Dmitry Dulepov [typo3]" <dmitry at typo3.org> schrieb im Newsbeitrag
news:mailman.1.1214582552.18181.typo3-team-core at lists.netfielders.de...
> 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)
ok, but for those comparisons it may be better to use strcasecmp. It
compares 2 strings without being case sensitive
>
> The following cases should use t3lib_div:
> - if (strtolower($var1) == strtolower($var2))
i think also using strcasecmp here would be the better choice
> - $var2 = strtolower($var2);
yes, here it's correct
>
> 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.
>
I will start it new, but this will take a while ;-)
vg Steffen
More information about the TYPO3-team-core
mailing list