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

Dmitry Dulepov [typo3] dmitry at typo3.org
Fri Jun 27 16:13:18 CEST 2008


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.

-- 
Dmitry Dulepov
http://typo3bloke.net/


More information about the TYPO3-team-core mailing list