|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-12-20 11:41 UTC] soenke dot ruempler at northclick dot de
Description: ------------ FILTER_VALIDATE_URL does validate CR, LF and TAB. I don't know if some RFC does allow this theory but practically this makes the URL filter completely unusable. Additionally it would be nice if the filter was more restrictive by default. Requiring scheme and host part is essential in 99,999999% of use cases. More useful would be flags like FILTER_FLAG_SCHEME_NOT_REQUIRED, FILTER_FLAG_HOST_NOT_REQUIRED ... Reproduce code: --------------- $ php -r "var_dump(filter_var(\"blah\n\n\t\rblub??\", FILTER_VALIDATE_URL));" Expected result: ---------------- bool(false) Actual result: -------------- string(14) "blah blub??" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Ok, that sounds good - I extract the following points: * Don't rely on parse_url() * URL with special characters is NOT valid * URL with whitespaces at the start or end is valid and the whitespace is trimmed in the returned string. * scheme and host are required by default ("blahblub" not valid, at least "asdf://blahblub" needed * Maybe FLAGS to turn scheme and host validation OFF (if someone finds it useful).