Edit report at https://bugs.php.net/bug.php?id=70799&edit=1
ID: 70799
Updated by: cmb@php.net
Reported by: yurets at gambler dot ru
-Summary: strcasecmp works incorrect for CP1251
+Summary: strcasecmp is not locale aware
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
Package: Strings related
Operating System: FreeBSD 10.1
PHP Version: 5.6.14
Block user comment: N
Private report: N
New Comment:
That behavior is to be expected, since strcasecmp() is *not*
locale aware (it only handles ASCII characters properly regarding
case-insensivity). That needs to be documented.
Previous Comments:
------------------------------------------------------------------------
[2015-10-27 05:30:54] yurets at gambler dot ru
Description:
------------
---
From manual page: http://www.php.net/function.strcasecmp
---
It's the same CP1251 symbol used in test script, upper- and lower-cased
No problems if using strtolower or strtoupper, only strcasecmp is affected.
Test script:
---------------
<?
setlocale( LC_ALL, "ru_RU.CP1251", "rus_RUS.CP1251",
"Russian_Russia.1251" );
echo strcasecmp( "Ð", "а" );
?>
Expected result:
----------------
0
Actual result:
--------------
-32
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70799&edit=1