Answers.Body: <p>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.</p>
  <pre><code>Change: 
  $part = idn_to_ascii($part, 0, INTL_IDNA_VARIANT_UTS46); 
  to 
  $part = idn_to_ascii($part);
  </code></pre>
  <p>This is how it was in the CiviCRM 5.19.2.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-18T16:32:42.147Z
Answers.Text: Tony: This also fixes entry in a normal contact, which is great. https://www.php.net/manual/en/function.idn-to-ascii.php shows that the UTS46 requires  ICU 4.6 and I have ICU 4.2 library installed on my server. THANK YOU! (Don't know what the next revision of CiviCRM will bring.)
Answers.UserDisplayName: TimETown
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-20T18:13:51.737Z
Answers.Text: Related discussion here: https://civicrm.stackexchange.com/questions/34098/confirm-from-email-error-in-configure-event
Answers.UserDisplayName: Jern
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-18T14:52:38.147Z
Answers.LastActivityDate: 2020-08-30T11:40:04.520Z
Answers.LastEditDate: 2020-08-30T11:40:04.520Z
Answers.UserDisplayName: Tony Michael
Body: <p>Just upgraded from 5.19.2 to 5.20.0. Upgrade appeared to run through without a hitch.<br/>Joomla! 3.9.13, php 7.3.12, mySQL 5.7.28<br/><br/>
  Now, when editing existing email address, or when  entering new contact details, saving fails with the following error message:<br/><br/>
  <b>Please correct the following errors in the form fields below:<br/>
  Email is not valid.</b><br/><br/>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?<br/><br/>[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.</p>
  
  <p>[Edit] Upgraded to 5.20.1 and the problem persists.</p>
  
  <p>[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. <a href="https://github.com/civicrm/civicrm-packages/pull/271.patch" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-packages/pull/271.patch</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-09T18:27:27.993Z
Comments.Text: 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 https://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 : )
Comments.UserDisplayName: MtnPavlas
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-10T08:08:55.483Z
Comments.Text: Thanks. That bug report relates to php 5.6.30. We're on php 7.3. Or did I misunderstand?
Comments.UserDisplayName: Jern
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-10T16:06:34.983Z
Comments.Text: 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?
Comments.UserDisplayName: Alan Dixon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-11T06:55:57.797Z
Comments.Text: Yes, the same error is present in multiple forms. I'm having to comment out the validation check in each one. The contact form looks unchanged.
Comments.UserDisplayName: Jern
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-16T16:35:58.720Z
Comments.Text: I have the same problem in Drupal 7 installation after upgrade to 5.20.0. Tried changing php version from 7.1 to 7.3 and it did not help.
Comments.UserDisplayName: TimETown
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-16T16:43:33.910Z
Comments.Text: And an upgrade to 5.20.2 does not help me.
Comments.UserDisplayName: TimETown
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-17T15:14:58.760Z
Comments.Text: Have a second installation (running php 7.2) and that has the same problem. In addition public facing forms using a Profile which includes email address fail and the  stopgap hack "[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." does not fix this. (Had to allow people to not include an email.)
Comments.UserDisplayName: TimETown
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-17T15:20:30.637Z
Comments.Text: 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).
Comments.UserDisplayName: TimETown
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-12-18T06:19:06.910Z
Comments.Text: 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: https://talk.plesk.com/threads/intl-ext-compiled-against-old-icu.346937/
  and a possible solution here: https://realpandablog.wordpress.com/2018/02/09/how-to-upgrade-icu-in-intl-in-php-7-0-x-for-linux-ubuntu-16-04/
  I haven't tried this yet.
Comments.UserDisplayName: Jern
Tags: <contacts><email><validation>
Title: After upgrading to 5.20.0 - unable to edit or enter contact email addresses- "Email is not valid."
ThreadText: # After upgrading to 5.20.0 - unable to edit or enter contact email addresses- "Email is not valid."
  
  (Asked by: username_0 on 2019-12-09)
  
  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>
  
  **Tags:** contacts, email, validation
  
  > **Comments:**
  > **username_1**: 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 https://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 : )  
  > **username_0**: Thanks. That bug report relates to php 5.6.30. We're on php 7.3. Or did I misunderstand?  
  > **username_2**: 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?  
  > **username_0**: Yes, the same error is present in multiple forms. I'm having to comment out the validation check in each one. The contact form looks unchanged.  
  > **username_3**: I have the same problem in Drupal 7 installation after upgrade to 5.20.0. Tried changing php version from 7.1 to 7.3 and it did not help.  
  > **username_3**: And an upgrade to 5.20.2 does not help me.  
  > **username_3**: Have a second installation (running php 7.2) and that has the same problem. In addition public facing forms using a Profile which includes email address fail and the  stopgap hack "[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." does not fix this. (Had to allow people to not include an email.)  
  > **username_3**: 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).  
  > **username_0**: Thanks @username_3. 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: https://talk.plesk.com/threads/intl-ext-compiled-against-old-icu.346937/ and a possible solution here: https://realpandablog.wordpress.com/2018/02/09/how-to-upgrade-icu-in-intl-in-php-7-0-x-for-linux-ubuntu-16-04/ I haven't tried this yet.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_4 on 2019-12-18. Score: 1 | Accepted answer
  
  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.
  Change: 
  $part = idn_to_ascii($part, 0, INTL_IDNA_VARIANT_UTS46); 
  to 
  $part = idn_to_ascii($part);
  
  This is how it was in the CiviCRM 5.19.2.
  
  > **Comments:**
  > **username_3**: Tony: This also fixes entry in a normal contact, which is great. https://www.php.net/manual/en/function.idn-to-ascii.php shows that the UTS46 requires  ICU 4.6 and I have ICU 4.2 library installed on my server. THANK YOU! (Don't know what the next revision of CiviCRM will bring.)  
  > **username_0**: Related discussion here: https://civicrm.stackexchange.com/questions/34098/confirm-from-email-error-in-configure-event  
  
  ---
  
  