|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65080 ctype_lower detects non-lower characters
Submitted: 2013-06-21 01:47 UTC Modified: 2015-05-08 23:11 UTC
From: masakielastic at gmail dot com Assigned:
Status: Open Package: Strings related
PHP Version: 5.5.0 OS: Mac OSX
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-06-21 01:47 UTC] masakielastic at gmail dot com
ctype_lower detects non-lower characters when the local is set to 'en_US.UTF-8' 
on Mac OSX 10.8. This phenomenon cannot't be reproduced on Ubuntu Linux.

This phenomenon means ctype_lower detects Chinese characters and Hangul (Korean 
Alphabet) which have no concept about lower and upper cases.

The test cases for C language and showing misdetected characters can be seen 

The tests for BSD-compatible OSes are needed judging from Xcode's manual.

ctype_upper also detects non-upper characters.

Test script:
$expected = [];
$result = [];
for ($i = 0; $i <= 0xFF; ++$i) {
    setlocale(LC_ALL, 'C');
    if (ctype_lower(chr($i))) {
        $expected[] = $i;
    setlocale(LC_ALL, 'en_US.UTF-8');
    if (ctype_lower(chr($i))) {
        $result[] = $i;
    [] === array_diff($result, $expected)

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-08 23:11 UTC]
Related to bug #63663.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 15:03:37 2021 UTC