Bug #53134

Regex Character class "alnum" not working correct in AlphanumericValidator

Added by Michael Gerdemann almost 8 years ago. Updated over 7 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Has patch:


The Regex Character class "alnum" not working correct in AlphanumericValidator.
A better regular expression would be:


Updated by Gerrit Code Review almost 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/25006


Updated by Karsten Dambekalns over 7 years ago

  • Category set to Validation
  • Status changed from Under Review to Needs Feedback
  • Assignee set to Karsten Dambekalns

I think this needs more background. Rasmus Lerdorf said this

I think the documentation is wrong on that. In Unicode mode [[:alnum:]] actually becomes \p{Xan} which should match Unicode chars as well, but only if PCRE was compiled with Unicode support. So I suspect you don't actually have a Unicode-capable PCRE build in some cases there.

about the PHP documentations saying

In UTF-8 mode, characters with values greater than 128 do not match any of the POSIX character classes.

(see http://grokbase.com/t/php/php-internals/12b5rfqxxc/incomprehension-with-preg-match-and-utf8#201211050tzcfjc0dmzpz0zj15z8w2j5mg)

So as long as PHP and the PCRE library support UTF-8, the use of the u flag in the validator should be enough. If UTF-8 support is missing or broken, the use of \p{L} probably doesn't help.

Could you provide a test case that shows the validator failing?


Updated by Michael Gerdemann over 7 years ago

In the meantime, we have updated the PHP version and the PCRE version, so the validator don't fail anymore.
With the previous versions the test failed. But the UTF8 support should have been correct.
I can't reproduce it now, so it's okay if this issue is closed.


Updated by Karsten Dambekalns over 7 years ago

  • Status changed from Needs Feedback to Closed

Ok, thanks for the quick feedback.

Also available in: Atom PDF