Bug #66108 [Com]: Setting locale to 'tr_TR' lowercases parts of constants
Edit report at https://bugs.php.net/bug.php?id=66108&edit=1
ID: 66108
Comment by: t dot baumgarden at web dot de
Reported by: t dot baumgarden at web dot de
Summary: Setting locale to 'tr_TR' lowercases parts of
constants
Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: CentOS 6
PHP Version: 5.5.6
Block user comment: N
Private report: N
New Comment:
You are right in PHP 5.3 (tested with online php)
But in PHP 5.6.3 (I acutal use) this bug is gone and all working fine.
setlocale(LC_ALL, 'tr_TR.UTF-8');
echo strtoupper('production');
show me "PRODUCTION" and not what you said "PRODUCTİON".
Why in PHP 5.6.3 this now working with "strtoupper"?
In PHP 5.3 its working only with "mb_strtoupper".
Previous Comments:
------------------------------------------------------------------------
[2015-04-01 21:06:41] stas@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is not the same as #18556 as you are manually using "strtoupper", which is
locale-dependent, so it does what you asked it to do - provides the locale-dependent uppercase
rendering of "production". Unfortunately, in tr_TR the uppercase of "production"
is "PRODUCTİON" and not "PRODUCTION". If you must use this locale, I'd
suggest using mb_strtoupper or mb_convert_case.
------------------------------------------------------------------------
[2015-02-26 10:56:07] jpauli@php.net
PHP's strtolower() has always been locale aware and works the same in 5.4 and 5.5.
Did I miss something ?
------------------------------------------------------------------------
[2014-09-10 15:04:32] chuanm at gmail dot com
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.
------------------------------------------------------------------------
[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"
------------------------------------------------------------------------
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=66108
--
Edit this bug report at https://bugs.php.net/bug.php?id=66108&edit=1
Thread (7 messages)