php filter email,php – 为什么filter_var($email,FILTER_VALIDATE_EMAIL)允许test @ test?

搜索热词

我只是设置一个表单的验证,我决定尝试使用filter_var函数来检查我的电子邮件地址的有效性.我无法找到什么filter_var实际允许的地方(因为文档很简单),我发现它允许一个电子邮件地址,如test @ test.在域中不必有.com,.net等…

@H_301_4@

这个行为在四月份左右发生了变化.见

bug #49576和

revision 297350.

那个电子邮件确实是无效的,至少这是PHP开发人员所理解的.来源提供此通知:

/*

* The regex below is based on a regex by Michael Rushton.

* However,it is not identical. I changed it to only consider routeable

* addresses as valid. Michael's regex considers a@b a valid address

* which conflicts with section 2.3.5 of RFC 5321 which states that:

*

* Only resolvable,fully-qualified domain names (FQDNs) are permitted

* when domain names are used in SMTP. In other words,names that can

* be resolved to MX RRs or address (i.e.,A or AAAA) RRs (as discussed

* in Section 5) are permitted,as are CNAME RRs whose targets can be

* resolved,in turn,to MX or address RRs. Local nicknames or

* unqualified names MUST NOT be used.

changelog提到了这个针对PHP 5.3.3和PHP 5.2.14的错误修复.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值