[TYPO3-core] RFC: #2302: substitute all strtoupper/strtolower with the t3lib_div-method

Steffen Kamper steffen at sk-typo3.de
Fri Jun 27 16:21:44 CEST 2008


"Dmitry Dulepov [typo3]" <dmitry at typo3.org> schrieb im Newsbeitrag 
news:mailman.1.1214575998.22018.typo3-team-core at lists.netfielders.de...
> Hi!
>
> Steffen Kamper wrote:
>> Problem: strtoupper and strtolower are not multibyte-safe. For this 
>> reason we added 2 methods in t3lib_div sometime ago.
>>
>> Now all calls in core to the native strtoupper/strtolower-functions 
>> should use these functions in t3lib_div instead.
>>
>> Applied patch does this
>
> Some changes do not make sense. For example:
>
> -       if (strtolower($level) == 'true' || $level === true) 
> { 
> +       if (t3lib_div::strtolower($level) == 'true' || $level === true) {
>
> -       $charset = trim(strtolower($charset)); 
> +       $charset = trim(t3lib_div::strtolower($charset));
>
> -       if ($gfxConf['gif_compress'] && 
> strtolower(substr($theFile,-4,4))=='.gif')  {   // GIF... 
> +       if ($gfxConf['gif_compress'] && 
> t3lib_div::strtolower(substr($theFile,-4,4))=='.gif')   {   // GIF...
> Last one does not make sense at all because you replace strtolower but 
> keep substr.
>
> I do not see a need to replace strtolower when result is tested for file 
> extension.
>
> -       $uppercaseIP = strtoupper($ip); 
> +       $uppercaseIP = t3lib_div::strtoupper($ip);
>
> Does not make sense either. If it includes non-ascii symbols it is not a 
> valid IP.
>
> I did not check more. It is enough to give -1 to the patch. Mechanical 
> changes without any real reasons cannot be accepted. Additionally you 
> decrease performance. Static method call is slower then built-in function 
> call. Here you have lots of such calls without any real reason for them.
>
> -- 

Hi Dmitry,

remember the turkish problem - if you apply strtoupper or strtolower to any 
string containing an "i" method will fail

So intention was to use it consequent on any place

vg Steffen 




More information about the TYPO3-team-core mailing list