php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27668 ctype_alpha fails to identify some characters
Submitted: 2004-03-24 02:11 UTC Modified: 2015-04-12 20:28 UTC
From: amd at tt dot ee Assigned:
Status: Not a bug Package: *Languages/Translation
PHP Version: 4.3.4 OS: Gentoo Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: amd at tt dot ee
New email:
PHP Version: OS:

 

 [2004-03-24 02:11 UTC] amd at tt dot ee
Description:
------------
ctype_alpha fails to identify at least two iso-8859-15 characters: s-caron (?) and z-caron (?) and their upper-case equivalents.

Reproduce code:
---------------
<?php
setlocale(LC_ALL,'et_EE');
header("Content-Type: text/html; charset=iso-8859-15;");
$strings = array('???aa','sete','a?ew', 'a?e','????','te?t','?ombie');
foreach ($strings as $testcase) {
	if (ctype_alpha($testcase)) {
		echo "Alpha test - $testcase - PASSED.<br />\n";
	} else {
		echo "Alpha test - $testcase - FAILED.<br />\n";
	}
}
?>

Expected result:
----------------
Alpha test - ???aa - PASSED.
Alpha test - sete - PASSED.
Alpha test - a?ew - PASSED.
Alpha test - a?e - PASSED.
Alpha test - ???? - PASSED.
Alpha test - te?t - PASSED.
Alpha test - ?ombie - PASSED.

Actual result:
--------------
Alpha test - ???aa - PASSED.
Alpha test - sete - PASSED.
Alpha test - a?ew - FAILED.
Alpha test - a?e - FAILED.
Alpha test - ???? - PASSED.
Alpha test - te?t - FAILED.
Alpha test - ?ombie - FAILED.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-25 10:44 UTC] derick@php.net
This is not a bug in PHP as PHP uses the OS functions to determine wheather something is an alpha character or not. Also, this has nothing to do with character sets at all, it's just the locale that matters. Do you actually have the et_EE locale installed? Anyway, this is not a bug in PHP.
 [2011-09-22 14:14 UTC] garioch2 at googlemail dot com
Actually there seems to be a problem with this function, 

I am german, and certainly the locale-Pack for de_DE,utf-8 is installed and i can use it for other things like printing dates in the correct language (month-names). But in case of ctype_alpha I get always the answer FALSE if testing a word containing one of the typical german letters ä,ö,ü,ß (and their capital counterparts) ..
 [2015-04-12 20:28 UTC] cmb@php.net
> I am german, and certainly the locale-Pack for de_DE,utf-8 is
> installed [...]

ctype_isalpha() relies on isalpha() which is locale aware, but
doesn't properly handle multibyte encodings such as UTF-8, see bug
#63663.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 17 03:03:44 2021 UTC