From:             
Operating system: Windows XP (SP3)
PHP version:      5.3SVN-2011-09-01 (SVN)
Package:          Mail related
Bug Type:         Bug
Bug description:filter_var($e, FILTER_VALIDATE_EMAIL) won't validate spaces in 
quoted strings

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 bug report at https://bugs.php.net/bug.php?id=55560&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=55560&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55560&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55560&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55560&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55560&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55560&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55560&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55560&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55560&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55560&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55560&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55560&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55560&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55560&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55560&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55560&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55560&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55560&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55560&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55560&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55560&r=mysqlcfg

Reply via email to