Just upgraded from 5.19.2 to 5.20.0. Upgrade appeared to run through without a hitch.
Joomla! 3.9.13, php 7.3.12, mySQL 5.7.28

Now, when editing existing email address, or when entering new contact details, saving fails with the following error message:

Please correct the following errors in the form fields below:
Email is not valid.

There's no corresponding error in the CiviCRM error log. Looks like the email address check isn't working properly. Has anyone else seen this?

[Edit] As a temporary solution, I have commented out line 62 of civicrm/CRM/Contact/Form/Edit/Email.php (the line which begins "$form->addRule"), but this is obviously only a stopgap.

[Edit] Upgraded to 5.20.1 and the problem persists.

[Edit] Problem is fixed in 5.20.2. So it was possible to upgrade directly from 5.19.2 to 5.20.2, but to upgrade to any of the intervening releases, the patch is needed. https://github.com/civicrm/civicrm-packages/pull/271.patch

  • We had the same issue (we're on the latest Joomla version); our awesome developer from Fuzion fixed this, and left this comment: The email validation seems to be due to a php bug bugs.php.net/bug.php?id=74276 which does not return any value for idn_to_ascii. I've fixed this in the code and it should be working now. Not sure if this is the same root cause as yours, but hey, something to consider : )
    – MtnPavlas
    Dec 9, 2019 at 18:27
  • Thanks. That bug report relates to php 5.6.30. We're on php 7.3. Or did I misunderstand?
    – Jern
    Dec 10, 2019 at 8:08
  • You're correct, that bug wouldn't be relevant. If it was an email validation issue, you should be able to reproduce that error in a few different forms that require email validation. Or perhaps it's a side effect of a different problem - do you see anything else different on the contact form?
    – Alan Dixon
    Dec 10, 2019 at 16:06
  • 1
    Find these in error log: Warning: Use of undefined constant INTL_IDNA_VARIANT_UTS46 - assumed 'INTL_IDNA_VARIANT_UTS46' (this will throw an Error in a future version of PHP) in HTML_QuickForm_Rule_Email->validate() (line 58 of /sites/all/modules/civicrm/packages/HTML/QuickForm/Rule/Email.php). Warning: idn_to_ascii() expects parameter 3 to be integer, string given in HTML_QuickForm_Rule_Email->validate() (line 58 of /sites/all/modules/civicrm/packages/HTML/QuickForm/Rule/Email.php).
    – TimETown
    Dec 17, 2019 at 15:20
  • 1
    Thanks @TimETown. It looks like the problem is with INTL, and more specifically with an out of date version of ICU. I'm using Plesk, which compiles php with ICU 4,2,1. This is extremely out of date and doesn't understand INTL_IDNA_VARIANT_UTS46. Current version of ICU is 65! More info here: talk.plesk.com/threads/intl-ext-compiled-against-old-icu.346937 and a possible solution here: realpandablog.wordpress.com/2018/02/09/… I haven't tried this yet.
    – Jern
    Dec 18, 2019 at 6:19

1 Answer 1


Thanks to the comments above, I have edited the packages/HTML/QuickForm/Rule/Email.php file to remove INTL_IDNA_VARIANT_UTS46. Forms with emails on them now work again.

$part = idn_to_ascii($part, 0, INTL_IDNA_VARIANT_UTS46); 
$part = idn_to_ascii($part);

This is how it was in the CiviCRM 5.19.2.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.