[Pushed] Registration impossible with Custom Profile Field using regex
Every now and then we got informed by users not being able to register because of a some Custom Profile Fields on our registration page (we use 2 additional fields). Error message: 'You did not enter a valid value for the "Shop Code" field. Please enter a valid value before continuing.'

None of our custom fields were ticked 'required' so we finally decided to pull them from our registration page just in case.
You can imagine our disbelief when we realized, when we got yet another email that registration would be impossible because of said custom field still being 'required', yet not even being displayed.

Since this wasn't true for the other field, I tried to find a pattern and I think I found it:

Custom profile field 1 ('required' not ticked): uses regex with [a-zA-Z] -> unintentionally 'required'
Custom profile field 2 ('required' not ticked): does not use regex -> works as advertised as not being 'required'

Immediately after deleting the regex of Custom Profile Field 1, everything was working fine again!
My guess would be, that the system checks for letters in regex Custom Field and therefore rejects an empty field?
I mean it mages sense regarding the regex, but why is a NULL entry being parset at all?
And if the field isnt enabled on the registration page, this is even more dangerous imho.
MabinogiDuelForum.com @ myBB 1.8.10
Hi sicut, sorry for the late reply. I can confirm this issue, however I don't know if it's intended behavior or not. The patch would be extremely simple:

inc/datahandlers/user.php, line 575:

if(!empty($profilefield['regex']) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field]))

Replace with:

if(!empty($profilefield['regex']) && !empty($profile_fields[$field]) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field]))

However, I would like to hear other opinions.
[Image: fSGNVQj.png]
I think this is a bug, what about others?
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
MyBB dev team?
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Yep, I'd say this is definitely a bug. If a field isn't displayed, obviously it cannot be filled in and shouldn't be checked.

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/2875

Thanks for contributing to MyBB!

The MyBB Group

Forum Jump:

Users browsing this thread: 1 Guest(s)