Bug #66108 [Com]: Setting locale to 'tr_TR' lowercases parts of constants

From: Date: Wed, 10 Sep 2014 15:04:32 +0000
Subject: Bug #66108 [Com]: Setting locale to 'tr_TR' lowercases parts of constants
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187505@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66108&edit=1 ID: 66108 Comment by: chuanm at gmail dot com Reported by: t dot baumgarden at web dot de Summary: Setting locale to 'tr_TR' lowercases parts of constants Status: Open Type: Bug Package: Scripting Engine problem Operating System: CentOS 6 PHP Version: 5.5.6 Block user comment: N Private report: N New Comment: The bug doesn't exist in php 5.4.31. So it could be introduced in php 5.5. The nasty part of this bug is that a locale change would affect how php handles some "English" letter. Previous Comments: ------------------------------------------------------------------------ [2014-09-10 14:51:13] chuanm at gmail dot com I think this bug also affects preg_match() function while using the case insensitive match modifier. Seems only letter 'i' has the problem. See example below: <?php setlocale(LC_ALL, 'tr_TR.UTF-8'); var_dump(preg_match('/I/i', 'production')); // output: no match found (WRONG) var_dump(preg_match('/O/i', 'production')); // output: one match found (correct) ------------------------------------------------------------------------ [2013-11-17 18:57:47] t dot baumgarden at web dot de In short: setlocale(LC_ALL, 'tr_TR.UTF-8'); echo strtoupper('production'); Result: "PRODUCTiON" with wrong "i" ------------------------------------------------------------------------ [2013-11-17 18:41:21] t dot baumgarden at web dot de Description: ------------ Hi. The (same?) bug was closed long time before here: https://bugs.php.net/bug.php?id=18556 Now its back in php 5.5.6. Write setlocale(LC_ALL, 'tr_TR.UTF-8'); I get: constant(): Couldn't find constant test::PRODUCTiON and complete page is broken. See "i" in "PRODUCTiON". Change 'tr_TR.UTF-8' to another string like 'en_US.UTF-8' now its working fine. Test script: --------------- class test { const PRODUCTION = 20; public static $environment = 10; } test::$environment = constant('test::'.strtoupper('production')); echo (test::$environment); Expected result: ---------------- 20 Actual result: -------------- Error message: constant(): Couldn't find constant test::PRODUCTiON ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66108&edit=1

« previous php.bugs (#187505) next »