|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-08-19 03:15 UTC] requinix@php.net
-Status: Open
+Status: Verified
[2015-08-19 03:15 UTC] requinix@php.net
[2015-08-19 13:08 UTC] cmb@php.net
[2015-08-19 13:18 UTC] rfredlund13 at gmail dot com
[2015-08-19 13:40 UTC] cmb@php.net
[2015-08-19 13:41 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2015-08-19 13:41 UTC] cmb@php.net
[2015-08-19 13:42 UTC] cmb@php.net
[2015-08-30 13:49 UTC] cmb@php.net
-Status: Verified
+Status: Closed
[2015-08-30 13:49 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 19:00:02 2025 UTC |
Description: ------------ I was writing unit tests (using PHPUnit) to validate my email validation functionality, which simply returned the result of filter_var($var, FILTER_SANITIZE_EMAIL). I tested all of the characters allowed in the documentation, but the / character was stripped out. I expected / to be a valid character. This is what the documentation states: FILTER_SANITIZE_EMAIL | Remove all characters except letters, digits and !#$%&'*+-/=?^_`{|}~@.[]. Found at http://php.net/manual/en/filter.filters.sanitize.php I then verified that this problem exists in the latest windows version as well (ran from command line with -r flag). This is either a problem with the implementation of the function, or inaccurate documentation. I briefly tried to interpret RFC 5321/RFC5322, but couldn't find this particular case. Test script: --------------- <?php echo "Output: " . filter_var('!#$%&\'*+-=?^_`{|}~@.[]', FILTER_SANITIZE_EMAIL); echo "\nOutput: " . filter_var('!#$%&\'*+-=?^_`{|}~@.[]/', FILTER_SANITIZE_EMAIL); echo "\nOutput: " . filter_var('/', FILTER_SANITIZE_EMAIL); ?> Expected result: ---------------- Output: !#$%&'*+-=?^_`{|}~@.[] Output: !#$%&'*+-=?^_`{|}~@.[]/ Output: / Actual result: -------------- Output: !#$%&'*+-=?^_`{|}~@.[] Output: !#$%&'*+-=?^_`{|}~@.[] Output: