How consistent is FILTER_VALIDATE_EMAIL?

前端 未结 1 1492
天涯浪人
天涯浪人 2020-12-19 03:37

Sample valid e-mail address:

\"this is a valid address\"@example.com

PHP code:



        
相关标签:
1条回答
  • 2020-12-19 04:04

    As you can see on http://3v4l.org/vKONS the usage of the filter FILTER_VALIDATE_EMAIL it is not consistent!

    http://3v4l.org/vKONS outputs for PHP 5.2.0, 5.2.14 - 5.2.17, 5.3.3 - 5.3.18, 5.4.0 - 5.4.8

    string(37) ""this is a valid address"@example.com" 
    bool(false)
    

    and for 5.2.1 - 5.2.13, 5.3.0 - 5.3.2

    string(37) ""this is a valid address"@example.com" 
    string(37) ""this is a valid address"@example.com"
    

    It is remarkable that it worked for 5.2.0 but not 5.2.1-5.2.13 and then again for 5.2.14!!!

    Btw 3v4l.org is a great resource to check such behavior changes across all available PHP versions.

    There are several bugs open including the term FILTER_VALIDATE_EMAIL, but none seems to match your kind of error. You might add it to the PHP bugtracker...

    0 讨论(0)
提交回复
热议问题