note 118590 deleted from filter.filters.validate by cmb

From: Date: Sat, 09 Jan 2016 01:23:56 +0000
Subject: note 118590 deleted from filter.filters.validate by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-204622@lists.php.net to get a copy of this message
Note Submitter: sebastian dot piskorski at gmail dot com ---- FILTER_VALIDATE_EMAIL not only doesn't support whitespace folding and comments. It only checks Addr-spec part of email address. Otherwise it should mark such address as valid: 'Test Example <test@example.com>' because it is valid according to RFC 822. Also address "test@localhost" should be valid. Which is mentioned in another note. You can test it with this code: <?php $emails = array( 'Test Example <test@example.com>', 'test@localhost', 'test@localhost.com' ); foreach ($emails as $email) { echo (filter_var($email, FILTER_VALIDATE_EMAIL)) ? "[+] Email '$email' is valid\n" : "[-] Email '$email' is NOT valid\n"; } ?> Output for PHP 5.3.21 - 7.0.1 : [-] Email 'Test Example <test@example.com>' is NOT valid [-] Email 'test@localhost' is NOT valid [+] Email 'test@localhost.com' is valid

« previous php.notes (#204622) next »