Welcome Guest, Not a member yet? Register   Sign In
Helpers and Other Conventions
#61

(07-11-2016, 05:08 PM)ivantcholakov Wrote: IMO valid_email() should not be deprecated, I doubt that filter_var($address, FILTER_VALIDATE_EMAIL) covers possible valid values like these that include international domain names.

This is the email_helper version of valid_email() from CI3:

PHP Code:
if ( ! function_exists('valid_email'))
{
    /**
     * Validate email address
     *
     * @deprecated 3.0.0 Use PHP's filter_var() instead
     * @param string $email
     * @return bool
     */
    function valid_email($email)
    {
        return (bool) filter_var($emailFILTER_VALIDATE_EMAIL);
    }


This is the valid_email() method in CI3's Form_validation library:

PHP Code:
/**
 * Valid Email
 *
 * @param string
 * @return bool
 */
public function valid_email($str)
{
    if (function_exists('idn_to_ascii') && $atpos strpos($str'@'))
    {
        $str substr($str0, ++$atpos).idn_to_ascii(substr($str$atpos));
    }

    return (bool) filter_var($strFILTER_VALIDATE_EMAIL);


Checking the commit for the difference between the two functions also reveals that the Email library contains yet another copy of this function. The version of the function in the two libraries makes some attempt to deal with non-ASCII domain names, but the version in the email helper does not (probably because the email helper was deprecated over 3 years ago).
Reply


Messages In This Thread
Helpers and Other Conventions - by prezire - 06-28-2016, 08:49 PM
RE: Helpers and Other Conventions - by kilishan - 06-28-2016, 09:06 PM
RE: Helpers and Other Conventions - by Narf - 06-29-2016, 01:17 AM
RE: Helpers and Other Conventions - by prezire - 06-28-2016, 11:35 PM
RE: Helpers and Other Conventions - by prezire - 06-29-2016, 04:21 AM
RE: Helpers and Other Conventions - by ciadmin - 06-29-2016, 04:59 AM
RE: Helpers and Other Conventions - by kilishan - 06-29-2016, 06:13 AM
RE: Helpers and Other Conventions - by Narf - 06-30-2016, 01:23 AM
RE: Helpers and Other Conventions - by InsiteFX - 06-29-2016, 06:26 AM
RE: Helpers and Other Conventions - by kilishan - 06-29-2016, 06:43 AM
RE: Helpers and Other Conventions - by prezire - 06-29-2016, 03:30 PM
RE: Helpers and Other Conventions - by kilishan - 06-29-2016, 07:38 PM
RE: Helpers and Other Conventions - by prezire - 06-29-2016, 10:53 PM
RE: Helpers and Other Conventions - by sv3tli0 - 06-29-2016, 11:12 PM
RE: Helpers and Other Conventions - by prezire - 06-30-2016, 12:11 AM
RE: Helpers and Other Conventions - by sv3tli0 - 06-30-2016, 12:32 AM
RE: Helpers and Other Conventions - by jlp - 06-30-2016, 12:53 AM
RE: Helpers and Other Conventions - by sv3tli0 - 06-30-2016, 01:45 AM
RE: Helpers and Other Conventions - by mixinix - 06-30-2016, 12:24 PM
RE: Helpers and Other Conventions - by prezire - 06-30-2016, 05:21 AM
RE: Helpers and Other Conventions - by Narf - 06-30-2016, 05:55 AM
RE: Helpers and Other Conventions - by kilishan - 06-30-2016, 06:14 AM
RE: Helpers and Other Conventions - by prezire - 06-30-2016, 06:51 AM
RE: Helpers and Other Conventions - by Narf - 06-30-2016, 08:02 AM
RE: Helpers and Other Conventions - by ciadmin - 06-30-2016, 11:28 AM
RE: Helpers and Other Conventions - by jlp - 07-04-2016, 09:38 AM
RE: Helpers and Other Conventions - by ciadmin - 06-30-2016, 12:02 PM
RE: Helpers and Other Conventions - by prezire - 06-30-2016, 03:53 PM
RE: Helpers and Other Conventions - by prezire - 06-30-2016, 05:00 PM
RE: Helpers and Other Conventions - by Narf - 07-01-2016, 02:17 AM
RE: Helpers and Other Conventions - by prezire - 07-01-2016, 03:09 AM
RE: Helpers and Other Conventions - by Narf - 07-01-2016, 03:16 AM
RE: Helpers and Other Conventions - by prezire - 07-01-2016, 04:01 AM
RE: Helpers and Other Conventions - by sv3tli0 - 07-01-2016, 04:02 AM
RE: Helpers and Other Conventions - by Narf - 07-01-2016, 04:27 AM
RE: Helpers and Other Conventions - by prezire - 07-01-2016, 05:02 AM
RE: Helpers and Other Conventions - by Narf - 07-01-2016, 05:07 AM
RE: Helpers and Other Conventions - by PaulD - 07-01-2016, 05:42 AM
RE: Helpers and Other Conventions - by awalls - 07-01-2016, 09:02 AM
RE: Helpers and Other Conventions - by prezire - 07-01-2016, 06:56 AM
RE: Helpers and Other Conventions - by PaulD - 07-01-2016, 08:01 AM
RE: Helpers and Other Conventions - by prezire - 07-01-2016, 03:16 PM
RE: Helpers and Other Conventions - by jlp - 07-04-2016, 09:46 AM
RE: Helpers and Other Conventions - by arma7x - 07-01-2016, 05:24 PM
RE: Helpers and Other Conventions - by prezire - 07-01-2016, 06:03 PM
RE: Helpers and Other Conventions - by Narf - 07-02-2016, 07:48 AM
RE: Helpers and Other Conventions - by arma7x - 07-02-2016, 05:21 AM
RE: Helpers and Other Conventions - by prezire - 07-02-2016, 11:35 PM
RE: Helpers and Other Conventions - by jlp - 07-04-2016, 09:53 AM
RE: Helpers and Other Conventions - by Muzikant - 07-05-2016, 07:59 AM
RE: Helpers and Other Conventions - by prezire - 07-05-2016, 04:17 PM
RE: Helpers and Other Conventions - by prezire - 07-10-2016, 09:00 AM
RE: Helpers and Other Conventions - by mwhitney - 07-11-2016, 02:05 PM
RE: Helpers and Other Conventions - by prezire - 07-11-2016, 05:29 PM
RE: Helpers and Other Conventions - by jlp - 07-11-2016, 03:03 PM
RE: Helpers and Other Conventions - by mwhitney - 07-12-2016, 06:08 AM
RE: Helpers and Other Conventions - by prezire - 08-01-2016, 06:52 AM
RE: Helpers and Other Conventions - by kilishan - 08-01-2016, 07:10 AM
RE: Helpers and Other Conventions - by prezire - 08-01-2016, 07:56 AM
RE: Helpers and Other Conventions - by meta - 12-09-2017, 04:56 PM
RE: Helpers and Other Conventions - by prezire - 12-10-2017, 05:40 PM
RE: Helpers and Other Conventions - by meta - 12-19-2017, 01:57 PM
RE: Helpers and Other Conventions - by prezire - 12-19-2017, 10:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB