phpBB Debug error showed during registration/username change

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Ideas Centre
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
User avatar
~Ivy
Registered User
Posts: 28
Joined: Fri Apr 06, 2007 2:07 pm
Location: Croatia, Europe
Contact:

phpBB Debug error showed during registration/username change

Post by ~Ivy »

I get this error when users try to register, or when I try to change their username via ACP. When users register, it also tells them that they're not using allowed characters.
[phpBB Debug] PHP Notice: in file /includes/functions_user.php on line 1395: mb_ereg_search_init() [function.mb-ereg-search-init]: mbregex compile err: premature end of char-class
[phpBB Debug] PHP Notice: in file /includes/functions_user.php on line 1396: mb_ereg_search() [function.mb-ereg-search]: No regex given
I used to think it had something to do with WP United mod I had installed on my forum (connects Wordpress and phpBB), but I deinstalled it and uploaded a completley fresh installation of phpBB3, and I got the same error again.

Lines 1395 and 1396 of /includes/functions_user.php are the following:

Code: Select all

		mb_ereg_search_init('^' . $username . '$', $regex, $matches);
		if (!mb_ereg_search())
Test forum I uploaded with fresh installation can be found here: http://www.e-tabularasa.com/forum2 if you want to see for yourself.

I have no idea what they mean and I have no clue how to fix this, so any help will be highly appreciated.

User avatar
~Ivy
Registered User
Posts: 28
Joined: Fri Apr 06, 2007 2:07 pm
Location: Croatia, Europe
Contact:

Re: phpBB Debug error showed during registration/username change

Post by ~Ivy »

Bump? :cry:

bloodjelly
Registered User
Posts: 34
Joined: Thu Aug 28, 2003 11:59 pm
Contact:

Re: phpBB Debug error showed during registration/username change

Post by bloodjelly »

I had this issue too and I fixed it by hard-coding a regular expression check into the validate_username function of functions_user.php. I replaced

Code: Select all

		mb_ereg_search_init('^' . $username . '$', $regex, $matches);
		if (!mb_ereg_search())
		{
			return 'INVALID_CHARS';
		}
with

Code: Select all

if(preg_match('/[^a-z0-9-_]/i',$username) || strlen($username) < 3 || strlen($username) > 20)
      {
         return 'INVALID_CHARS';
      }
This is probably NOT the way to do it, but in my particular case it does what I want, at least for the time being (before this nobody could register!). Basically the username can only be between 3 and 20 alphanumeric characters with no spaces or special characters other than - or _

Locked

Return to “[3.0.x] Support Forum”