[Typo3-dev] bug in tslib_cObj->caseshift

Martin Kutschker Martin.T.Kutschker at blackbox.net
Fri Oct 10 09:31:27 CEST 2003


Hi!

Browsing in the code I found a suspicious method for cObj: the case conversion.

The function starts with strtoupper/strtolower which is fine for single-byte characters. But this function is affected by locales. If Typo3 or some extension author sets a locale it might or might not do what you expect.

Then the functions do a strtr, which is certainly wrong for character sets other than iso-8859-1 (or iso-8859-15 and windows-1252, might nearly work for iso-8859-2 or windows-1250 and other latin iso-8859 encodings). For 3.5.1 I suggest to rely on locales (which may be a little tricky due the poor naming conventions of them) or at least don't do the strtr if config.locale_all is set. 3.6 should either use a (new) method of t3lib_cs or also use locales.

Either way strtr is wrong if it does not account for the character set of the string. I opt for a new method in t3lib_cs (which may make use of mbstring internally if Typo3 is configured to use this PHP extension).

Masi

PS: strtr does not work on multi-byte characters. 






More information about the TYPO3-dev mailing list