Bug #72547 [NEW]: \p{Ll} fails to match accented lowercase characters.
From: sprunka at gmail dot com
Operating system: All
PHP version: Irrelevant
Package: PCRE related
Bug Type: Bug
Bug description:\p{Ll} fails to match accented lowercase characters.
Description:
------------
While testing code for matching password complexity, I noticed the
\p{Lu} matches all uppercase characters correctly, but \p{Ll} fails to
match accented characters. The German "double s" character is debatable
whether it should pass or fail. It is definitively a lowercase
character, but it has no uppercase variant. Therefore, by definition or
\p{Ll} it should not match, but all other cases I can find for it in
PCRE examples do have it match \p{Ll}. I have included it as passing as
a lower case in the "expected" results below.
Test script:
---------------
<?php
// SHOULD PASS. Passes all 5.0.5 and thereafter.
$passwordTestArray[] = 'Aa';
// SHOULD PASS. Passes all 5.0.5 and thereafter.
$passwordTestArray[] = 'Ãa';
// SHOULD PASS. Fails after 5.2.10. Passes 5.0.5 - 5.2.9
$passwordTestArray[] = 'Aæ';
// SHOULD PASS. Fails after 5.2.10. Passes 5.0.5 - 5.2.9
$passwordTestArray[] = 'Ãæ';
// SHOULD FAIL because à does not have an uppercase equiv. But it
passses anyway in 5.0.5 - 5.2.9
$passwordTestArray[] = 'AÃ';
// SHOULD FAIL because there is no uppercase Ã.
// It fails for the wrong reasons in 5.0.5 - 5.2.9
// It passes in 5.2.10 and beyond.
$passwordTestArray[] = 'aÃ';
class PCREFail
{
static public function verifyComplexity($plainTextPassword)
{
$re = "/(?=.*[\\p{Ll}])(?=.*[\\p{Lu}]).{2,}/";
$found = preg_match_all($re, $plainTextPassword, $matches);
if ($found) {
return $matches;
}
return $found;
}
}
foreach ($passwordTestArray as $passwordToTest) {
var_dump(PCREFail::verifyComplexity($passwordToTest));
}
Expected result:
----------------
array(1) {
[0]=>
array(1) {
[0]=>
string(2) "Aa"
}
}
array(1) {
[0]=>
array(1) {
[0]=>
string(3) "Ãa"
}
}
array(1) {
[0]=>
array(1) {
[0]=>
string(3) "Aæ"
}
}
array(1) {
[0]=>
array(1) {
[0]=>
string(4) "Ãæ"
}
}
array(1) {
[0]=>
array(1) {
[0]=>
string(3) "AÃ"
}
}
int(0)
Actual result:
--------------
array(1) {
[0]=>
array(1) {
[0]=>
string(2) "Aa"
}
}
array(1) {
[0]=>
array(1) {
[0]=>
string(3) "Ãa"
}
}
int(0)
int(0)
int(0)
array(1) {
[0]=>
array(1) {
[0]=>
string(3) "aÃ"
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=72547&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72547&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72547&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72547&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72547&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72547&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72547&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72547&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72547&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72547&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72547&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72547&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72547&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72547&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72547&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72547&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72547&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72547&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72547&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72547&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72547&r=mysqlcfg
Thread (5 messages)
- sprunka at gmail dot com