|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70799 strcasecmp is not locale aware
Submitted: 2015-10-27 05:30 UTC Modified: 2020-01-27 11:20 UTC
From: yurets at gambler dot ru Assigned:
Status: Verified Package: Strings related
PHP Version: 5.6.14 OS: FreeBSD 10.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: yurets at gambler dot ru
New email:
PHP Version: OS:


 [2015-10-27 05:30 UTC] yurets at gambler dot ru
From manual page:
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:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-28 21:59 UTC]
-Package: Unknown/Other Function +Package: Strings related
 [2020-01-27 11:20 UTC]
-Summary: strcasecmp works incorrect for CP1251 +Summary: strcasecmp is not locale aware -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem
 [2020-01-27 11:20 UTC]
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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jun 19 16:01:23 2021 UTC