Bug #55560 [Opn->Csd]: filter_var($e, FILTER_VALIDATE_EMAIL) won't validate spaces in quoted strings
| From: | fredgandt at hotmail dot com | Date: | Thu, 01 Sep 2011 12:04:32 +0000 |
| Subject: | Bug #55560 [Opn->Csd]: filter_var($e, FILTER_VALIDATE_EMAIL) won't validate spaces in quoted strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-163224@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55560&edit=1
ID: 55560
User updated by: fredgandt at hotmail dot com
Reported by: fredgandt at hotmail dot com
Summary: filter_var($e, FILTER_VALIDATE_EMAIL) won't validate
spaces in quoted strings
-Status: Open
+Status: Closed
Type: Bug
Package: Mail related
Operating System: Windows XP (SP3)
PHP Version: 5.3SVN-2011-09-01 (SVN)
Block user comment: N
Private report: N
New Comment:
Really sorry. RFC is hard to read so I relied on Wikipedia (usually very good with
this kind of thing). Spaces aren't ever allowed. Not even within quotes. Going to
edit Wikipedia now instead of waste your time.
Forgive? ;-)
Previous Comments:
------------------------------------------------------------------------
[2011-09-01 11:38:43] fredgandt at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/filter.filters.validate
---
IMPORTANT: I am a learner. Sorry if I am wasting your time. Also GoDaddy don't
supply much in the way of detail about what version is running. All I know is
that it is 5.3.? I have asked for the rest but am still waiting.
Using filter_var($e, FILTER_VALIDATE_EMAIL) where $e is a submitted email
address that according to RFC 5321 and Wikipedias clearer to understand
interpretation of it should be considered valid, the return can be invalid where
spaces are featured within quoted strings.
e.g.
A-Za-z0-9."?Oooh![what]{fun}|is|!".gladthisisn'tmyaddress@[32.64.128.1] == valid
(impressive)
"Fred Gandt"@fredgandt.com == invalid
Take the space out and "FredGandt"@fredgandt.com == valid
I've tested all the most unusual combinations I can think of and
FILTER_VALIDATE_EMAIL seems to only fail with spaces being disallowed outright
rather than only being disallowed when not enclosed by quotes (as with other
otherwise disallowed chars).
If my interpretation of RFC 5321 is wrong and spaces are in fact never allowed
(even when enclosed by quotes) please forgive my impertinence.
Love PHP. Very slick and user friendlyness abounds!
Test script:
---------------
<html><body><br>
<form action="" method="post">
<input type="text" name="email" size="100">
<input type="submit" value="POST"><br><br>
<?php
$e=$_REQUEST["email"];
$result=filter_var($e, FILTER_VALIDATE_EMAIL);
if($result){echo($e."<br><br><b style=\"color:#008800;\">Valid
Email Address</b>");}
else{echo($e."<br><br><b style=\"color:#ff0000;\">Invalid Email
Address</b>");}
?>
</form></body></html>
Expected result:
----------------
Test script provides form entry field "input type="text""
Fill in "textbox" with email address having a local-part with a quoted string
containing spaces.
e.g. "Fred Gandt"@fredgandt.com
Submit
EXPECT: Return (echo) == Valid
Actual result:
--------------
OBSERVE: Return (echo) == Invalid
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55560&edit=1