Welcome Guest, Not a member yet? Register   Sign In
[split] Bug in new form validation?

(01-17-2018, 02:30 PM)what do you think about using of code v.3.1.6 in this case ? Wrote: /that same in email.php library/

public function valid_email($str)
if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches))
 if (defined('INTL_IDNA_VARIANT_UTS46'))
  $domain = is_php('5.4')
  ? idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46)
  : idn_to_ascii($matches[2]);
  $str = $matches[1].'@'.$domain; 
 } else {
  $str = $matches[1].'@'.idn_to_ascii($matches[2]); 

return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);

Hello all, also getting
ERROR - 2018-05-08 22:07:39 --> Severity: 8192 --> idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated *clients server*/public_html/system/libraries/Form_validation.php 1236

When using PHP 7.2, this error prevented me from getting a correct response in JSON upon successful email sent condition....well I switched to 7.1 and everything works fine.
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.

(01-17-2018, 08:49 AM)Muzikant Wrote: I can confirm a bug. I am getting two errors, when I am validating an e-mail address.

A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant INTL_IDNA_VARIANT_UTS46 - assumed 'INTL_IDNA_VARIANT_UTS46'
Filename: libraries/Form_validation.php
Line Number: 1235

A PHP Error was encountered
Severity: Warning
Message: idn_to_ascii() expects parameter 3 to be integer, string given
Filename: libraries/Form_validation.php
Line Number: 1235

PHP Code:
/*Line 1230*/ public function valid_email($str)
/*Line 1231*/ {
/*Line 1232*/   if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#'$str$matches))
/*Line 1233*/   {
/*Line 1234*/     $domain is_php('5.4')
/*Line 1235*/       idn_to_ascii($matches[2], 0INTL_IDNA_VARIANT_UTS46)
/*Line 1236*/       idn_to_ascii($matches[2]);
/*Line 1237*/     $str $matches[1].'@'.$domain;
/*Line 1238*/   }
/*Line 1239*/ 
/*Line 1240*/ 
  return (bool) filter_var($strFILTER_VALIDATE_EMAIL);
/*Line 1241*/ 

An errors occuring only on one of my webhostings, so the problem could be in server configuration (I tried four different companies, localhost if also fine).

they were hapened to me

(01-19-2018, 02:37 AM)Narfthank you this helped me Wrote:
(01-17-2018, 02:30 PM)mstojanov Wrote: The INTL_IDNA_VARIANT_UTS46 constant is available in PHP 5.4.0 but the intl extension uses the ICU system lib and some servers have a really old version of the ICU lib. Support for UTS 46 Unicode IDNA Compatibility Processing was added in ICU 4.6 and released on 2010-12-02.

Well, shit ... You've hit the nail right on the head here.

PHP sets ICU 4.0 as a minimum requirement, even on PHP 7.2 where this practically cannot work clean without ICU 4.6. That's a horrible stalemate and they've definitely dropped the ball on this - I'll raise the issue on internals.

In the meantime we'll apply some variation of the work-around you've suggested.

thank you this helped me

Theme © iAndrew 2016 - Forum software by © MyBB