Bug #18556 [Com]: Setting locale to 'tr_TR' lowercases class names
Edit report at https://bugs.php.net/bug.php?id=18556edit=1 ID: 18556 Comment by: gerd dot katzenbeisser at gmail dot com Reported by:spud at nothingness dot org Summary:Setting locale to 'tr_TR' lowercases class names Status: Assigned Type: Bug Package:Scripting Engine problem Operating System: Linux (RedHat 7.2) PHP Version:5CVS, 4CVS (2005-10-04) Assigned To:dmitry Block user comment: N Private report: N New Comment: This will probably break a lot of existing PHP Code. Why not performing the lookup case-sensitive and if not found fall back to case-insensitive? And if found case- insensitive throw a deprecation warning. Previous Comments: [2011-12-07 18:01:37] cankoy at ymail dot com This, practically, can't be fixed. Mainly because there's no way to know if 'I' is uppercase of 'i' or 'ı' since there's not a separate place for Turkish 'I' in code tables. The same holds for 'i' (can't be known if it's lowercase of 'I' or 'İ'). I told 2 years ago and will say it again: PHP should provide a way to turn off case-insensitive function/class name lookup. No good programmer uses this Basic language feature since identifiers are case-sensitive in all real languages like Python, Ruby, C#, Java. [2011-12-03 22:08:24] sg at facelift-bbt dot com This bug was first reported 9 years ago? This definetly got to be fixed. This is a total stopper. I can reproduce it exactly it is shown below. [2011-11-06 19:29:44] gerd dot katzenbeisser at gmail dot com here is a simple test case using the internal class PharFileInfo ? $class = 'PharFileInfo'; echo 'Locale: '.setlocale(LC_ALL, '0').\n; echo $class exists? .var_export(class_exists($class), true).\n; echo 'Locale: '.setlocale(LC_ALL, 'tr_TR.UTF-8').\n; echo $class exists? .var_export(class_exists($class), true); ? Output: Locale: C PharFileInfo exists? true Locale: tr_TR.UTF-8 PharFileInfo exists? false [2011-09-16 14:18:21] robin dot bussiek at googlemail dot com @sweiss-at-stylesight thanks for your explanation. Big +1 for any solution to this topic. [2011-09-15 19:59:27] sweiss at stylesight dot com No, the problem results because lowercase i (in most languages) and uppercase I (in most languages) are not actually considered to be the upper/lower variant of the same letter in Turkish. In Turkish, the undotted ı is the lowercase of I, and the dotted İ is the uppercase of i. If you have a class named Image, it will break if the locale is changed to turkish because class_exists() function uses zend_str_tolower(), and changes the case on all classes, because they are supposed to be case insensitive. Someone else above explained it very well: class_exists() function uses zend_str_tolower(). zend_str_tolower() uses zend_tolower(). zend_tolower() uses _tolower_l() on Windows and tolower() on other oses. _tolower_l() is not locale aware. tolower() is LC_CTYPE aware. Please, oh please, can someone fix this already? It has been a very long time and it's extremely annoying and difficult to work around if you have a large multilingual website. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=18556 -- Edit this bug report at https://bugs.php.net/bug.php?id=18556edit=1
Bug #18556 [Com]: Setting locale to 'tr_TR' lowercases class names
Edit report at https://bugs.php.net/bug.php?id=18556edit=1 ID: 18556 Comment by: gerd dot katzenbeisser at gmail dot com Reported by:spud at nothingness dot org Summary:Setting locale to 'tr_TR' lowercases class names Status: Assigned Type: Bug Package:Scripting Engine problem Operating System: Linux (RedHat 7.2) PHP Version:5CVS, 4CVS (2005-10-04) Assigned To:dmitry Block user comment: N Private report: N New Comment: here is a simple test case using the internal class PharFileInfo ? $class = 'PharFileInfo'; echo 'Locale: '.setlocale(LC_ALL, '0').\n; echo $class exists? .var_export(class_exists($class), true).\n; echo 'Locale: '.setlocale(LC_ALL, 'tr_TR.UTF-8').\n; echo $class exists? .var_export(class_exists($class), true); ? Output: Locale: C PharFileInfo exists? true Locale: tr_TR.UTF-8 PharFileInfo exists? false Previous Comments: [2011-09-16 14:18:21] robin dot bussiek at googlemail dot com @sweiss-at-stylesight thanks for your explanation. Big +1 for any solution to this topic. [2011-09-15 19:59:27] sweiss at stylesight dot com No, the problem results because lowercase i (in most languages) and uppercase I (in most languages) are not actually considered to be the upper/lower variant of the same letter in Turkish. In Turkish, the undotted ı is the lowercase of I, and the dotted İ is the uppercase of i. If you have a class named Image, it will break if the locale is changed to turkish because class_exists() function uses zend_str_tolower(), and changes the case on all classes, because they are supposed to be case insensitive. Someone else above explained it very well: class_exists() function uses zend_str_tolower(). zend_str_tolower() uses zend_tolower(). zend_tolower() uses _tolower_l() on Windows and tolower() on other oses. _tolower_l() is not locale aware. tolower() is LC_CTYPE aware. Please, oh please, can someone fix this already? It has been a very long time and it's extremely annoying and difficult to work around if you have a large multilingual website. [2011-09-15 19:51:48] robin dot bussiek at googlemail dot com I am sorry to ask this for my understanding: Is it true, that the cause for this bug lies in a false inclusion of the I character in the Turkish character set - and therefore results in an unnecessary replacement? If so, my green knowledge leads me to the assumption, that a fix should be rather simple. **duck**, Robin [2011-08-08 12:02:30] tolga at profelis dot com dot tr php -v PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011 08:24:40) Problem continues! [2010-08-28 12:14:34] web-coder at list dot ru Thanks to Alexey dot Rybak at gmail dot com for a patch, that fix problem if you use only ASCII-symbols in functions/methods names: http://dev.badoo.com/custom_strtolower.diff The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=18556 -- Edit this bug report at https://bugs.php.net/bug.php?id=18556edit=1
Bug #35050 [Com]: Capital I letters in func/class method names do not work with turkish locale
Edit report at https://bugs.php.net/bug.php?id=35050edit=1 ID: 35050 Comment by: gerd dot katzenbeisser at gmail dot com Reported by:satanistlav at mail dot ru Summary:Capital I letters in func/class method names do not work with turkish locale Status: Wont fix Type: Bug Package:Scripting Engine problem Operating System: Linux PHP Version:5CVS-2005-11-01 (cvs) Block user comment: N Private report: N New Comment: This Bug is a duplicate of Bug #18556 Previous Comments: [2010-04-16 19:38:44] sweiss at stylesight dot com Requesting a fix for this... this has been going on for almost 5 years, yet the proper fix for the problem also only takes that many lines of code, according to a different bug report, which was rejected on a technicality. The workaround suggested means that none of my turkish is capitalized correctly. This is really not going over well. Please, please, please, at least make the fix listed in Bug #35050 an option that we can set in the php.ini or ideally with ini_set or *something*, if it causes problems for other programmers, and if it doesn't, can it just be fixed already? It is not going to be pretty when I have to go tell them that the turkish translation they've made is going to be permanently crippled until PHP 6 is released, and our code is updated to support it... and it looks like PHP 6 just went back to square one so this could be quite a long time. [2007-09-06 11:22:42] j...@php.net Patch by Tomas Kuliavas: http://www.topolis.lt/php/#35050 [2005-11-15 13:39:07] der...@php.net We discussed it and this will not be addressed in PHP 5, but only from PHP 6 and higher. Please make sure your set the correct locale before starting the script - or before including files that define elements that contain upper case I's. [2005-11-01 15:17:54] satanistlav at mail dot ru I have uploaded your code to the server and I still have the same error! http://www.yda.com.tr/test.php [2005-11-01 15:14:14] satanistlav at mail dot ru I have multilingual site. Locales are set to en_US.ISO-8859-1 in Enlgish side of the site and tr_TR.ISO-8859-9 in Turkish for LC_ALL The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=35050 -- Edit this bug report at https://bugs.php.net/bug.php?id=35050edit=1