HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

ValidateUsername problem Vanilla and php 5.3.23 ?


I ran into a problem with php 5.3.23 and Vanilla Forums Upon registration, users would get the error:

Username can only contain letters, numbers, underscores, and must be between 3 and 20 characters long.

regardless of whether they submitted a valid username or not. I found that the regex for validating usernames was having a problem:


produced the warning:

PHP Warning: preg_match(): Compilation failed: unknown option bit(s) set at offset 0

and $Matches would be NULL.

It looks like it was the u bit that was causing the problem.


  • Options
    hgtonighthgtonight ∞ · New MVP

    I haven't run into this issue on xampp my webhost.

    The u option turns on additional functionality of PCRE that is incompatible with Perl. Pattern strings are treated as UTF-8. This modifier is available from PHP 4.1.0 or greater on Unix and from PHP 4.2.3 on win32. UTF-8 validity of the pattern is checked since PHP 4.3.5.


    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.