isemail validation not working well

jfquestiaux

Well-Known Member
There are some flaws in the "isemail" validation as it validates adresses with wrong domain names.
For instance:
  • "jfquestiaux@" reports an error
  • but "jfquestiaux@b" pass the validation
Tested on GitHub from May 28th
 
That's because the second one is technically valid, as it would work for a local hostname delivery.

-- hugh
 
Note that all we do is call J!'s email validation, which (iirc) just uses on of the standard open source classes for validating. So we don't make the decisions, J! does.

-- hugh
 
Well then Joomla! has changed something because in J! 2.5 and fabrik 3 "john@b" fails (as expected - the localhost thing is a corner case I think), and I am quite sure that in J! 3 + Fabrik 3.1, this failed too.
 
Hugh looking at the code we don't use Joomla's isEmail() method - but our own. No comment really on what is or is not a valid email, but I can't remember people complaining about the code we have, which hasnt changed in years as far as Im aware.
 
Well something has changed, maybe not on your side but on Joomla's so your isEmail() function changed its behaviour.
As I said above, a wrong syntax for the domain name was caught by Fabrik 3.0/J 2.5 while it's not with Fabrik 3.1/J 3.1. For the latest, if I comment out line 66
PHP:
return FabrikWorker::isEmail($email);
the syntax error is caught.

Of course, it is probably now the code some people were complaining about that is used but I don't know where this FabrikWorker::isEmail($email) is located to check it.
 
ok Hugh is correct FabrikWorker::isEmail is a proxy to JMailHelper::isEmailAddress

PHP:
    /**
     * Is the email really an email (more strict than JMailHelper::isEmailAddress())
     *
     * [USER=20939]param[/USER]   string  $email  email address
     *
     * @since 3.0.4
     *
     * @return bool
     */

    public static function isEmail($email)
    {
        $conf = JFactory::getConfig();
        $mail = JFactory::getMailer();
        $mailer = $conf->get('mailer');
        if ($mailer === 'mail')
        {
            // Sendmail and Joomla isEmailAddress dont use the same conditions
            return (JMailHelper::isEmailAddress($email) && PHPMailer::ValidateAddress($email));
        }
        return JMailHelper::isEmailAddress($email);
    }

Thinking about this, I think the reasoning behind this was that our old code might validate an email which the JMailer would then say it couldn't mail to.

Both 3.1 and 3.0 since 3.0.4 use the same method.
 
Well you're right, it is in Joomla!: I tested with the default J! registration form and "a@a" is considered as valid.
I don't know whether it is an intended change to accomodate local hostname delivery as Hugh suggested or a bug.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top