Not sure if this is a bug, but it worth a shot. (SMF 2.0.7)
I've been playing around with registerMember() function located in Subs-Members.php.
This function accepts 2 parameters:
function registerMember(&$regOptions, $return_errors = false)
I setup a custom code in my site which uses this function to register. So I pass the the $regOptions with $return_errors to true and happily get back the result of the registration which can contain errors. That's generally what I'd expect from using a function in "Subs" sources.
But there are still some parts in this function which will generate a fatal error despite the fact that $return_errors is set to true:
// Put any errors in here.
$reg_errors = array();// Registration from the admin center, let them sweat a little more.
if ($regOptions['interface'] == 'admin')
{
is_not_guest();
isAllowedTo('moderate_forum');
}
// If you're an admin, you're special ;).
elseif ($regOptions['interface'] == 'guest')
{
// You cannot register twice...
if (empty($user_info['is_guest']))
redirectexit();
// Make sure they didn't just register with this session.
if (!empty($_SESSION['just_registered']) && empty($modSettings['disableRegisterCheck']))
fatal_lang_error('register_only_once', false);
}
Is there a reason we have fatal errors there? or it's a bug that has slipped through?
I noticed that bug, when creating a user and tried creating another one right after. so fatal_lang_error('register_only_once', false); kicked in and ended my code. I was expecting it would return the 'register_only_once' text error not making it fatal.
Hope this helps
0 commentaires:
Enregistrer un commentaire