Re: [PHP] Re: Issue with filter_var and FILTER_VALIDATE_EMAIL

2009-06-19 Thread Bastien Koert
On Fri, Jun 19, 2009 at 11:46 AM, Shawn McKenzienos...@mckenzies.net wrote:
 Bastien Koert wrote:
 On Fri, Jun 19, 2009 at 11:20 AM, Jonathan Tapicertapi...@gmail.com wrote:
 Did you execute the code I sent? Does it give you a false?

 Jonathan

 On Fri, Jun 19, 2009 at 12:17 PM, Bastien Koertphps...@gmail.com wrote:
 Correct, I send the @


 Bastien

 On Friday, June 19, 2009, Jonathan Tapicer tapi...@gmail.com wrote:
 Works for me:

          var_dump(filter_var('bastien_k(a)hotmail.com 
 http://hotmail.com',
 FILTER_VALIDATE_EMAIL) !== false); //replace (a) with @

 Gives:

          bool(true)

 You are sending an @ instead of  at , right?

 Jonathan


 On Fri, Jun 19, 2009 at 11:49 AM, Bastien Koertphps...@gmail.com wrote:
 Hey guys,

 Running the new version of PHPMailer and my hotmail address fails the
 validation.

 Email address is bastien_k at hotmail dot com

 Any ideas?

 --

 Bastien

 Cat, the other other white meat

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --

 Bastien

 Cat, the other other white meat


 this is the relevant function from phpmailer
   public static function ValidateAddress($address) {
     if (function_exists('filter_var')) { //Introduced in PHP 5.2
       if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
         return false;
       } else {
        return true;
       }
     } else {
       return 
 preg_match('/^(?:[\w\!\#\$\%\\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/',
 $address);
     }

   }




 Is your PHP version = 5.2?  If not then the regex will return 1, so in
 your code don't check for === true.  Try == true if that's what you're
 doing.

 --
 Thanks!
 -Shawn
 http://www.spidean.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




its 5.2.4
-- 

Bastien

Cat, the other other white meat

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Issue with filter_var and FILTER_VALIDATE_EMAIL

2009-06-19 Thread Jonathan Tapicer
Can you check if the code is using true or false branch of the first if?


On Fri, Jun 19, 2009 at 12:56 PM, Bastien Koertphps...@gmail.com wrote:
 On Fri, Jun 19, 2009 at 11:46 AM, Shawn McKenzienos...@mckenzies.net wrote:
 Bastien Koert wrote:
 On Fri, Jun 19, 2009 at 11:20 AM, Jonathan Tapicertapi...@gmail.com wrote:
 Did you execute the code I sent? Does it give you a false?

 Jonathan

 On Fri, Jun 19, 2009 at 12:17 PM, Bastien Koertphps...@gmail.com wrote:
 Correct, I send the @


 Bastien

 On Friday, June 19, 2009, Jonathan Tapicer tapi...@gmail.com wrote:
 Works for me:

          var_dump(filter_var('bastien_k(a)hotmail.com 
 http://hotmail.com',
 FILTER_VALIDATE_EMAIL) !== false); //replace (a) with @

 Gives:

          bool(true)

 You are sending an @ instead of  at , right?

 Jonathan


 On Fri, Jun 19, 2009 at 11:49 AM, Bastien Koertphps...@gmail.com wrote:
 Hey guys,

 Running the new version of PHPMailer and my hotmail address fails the
 validation.

 Email address is bastien_k at hotmail dot com

 Any ideas?

 --

 Bastien

 Cat, the other other white meat

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --

 Bastien

 Cat, the other other white meat


 this is the relevant function from phpmailer
   public static function ValidateAddress($address) {
     if (function_exists('filter_var')) { //Introduced in PHP 5.2
       if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
         return false;
       } else {
        return true;
       }
     } else {
       return 
 preg_match('/^(?:[\w\!\#\$\%\\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/',
 $address);
     }

   }




 Is your PHP version = 5.2?  If not then the regex will return 1, so in
 your code don't check for === true.  Try == true if that's what you're
 doing.

 --
 Thanks!
 -Shawn
 http://www.spidean.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




 its 5.2.4
 --

 Bastien

 Cat, the other other white meat

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php