From: leo at leo-unglaub dot net
Operating system: Debian Linux
PHP version: 5.4.7
Package: URL related
Bug Type: Bug
Bug description:FILTER_FLAG_PATH_REQUIRED is true even if there is no path
Description:
------------
Hey,
if you validate a given url with the function filter_var and the param
FILTER_VALIDATE_URL with the flag FILTER_FLAG_PATH_REQUIRED you also get
true back if there is no path.
The function is happy with the result if there is a simple / at the end of
the function. But thats not a valid path. A valid path would be at least 1
char after the /. I added you some examples below.
thanks and greetings
Leo
Test script:
---------------
php -r 'var_dump(filter_var("http://php.net/", FILTER_VALIDATE_URL,
FILTER_FLAG_PATH_REQUIRED));' // <- will be okay, but it's not.
php -r 'var_dump(filter_var("http://php.net/foobar", FILTER_VALIDATE_URL,
FILTER_FLAG_PATH_REQUIRED));' // <- that would be okay.
Expected result:
----------------
filter_var() should return false if the path is not given/empty because
according to the documentation if forces the requirement of a path.
Actual result:
--------------
filter_var is okay with an url if there is a / at the end.
--
Edit bug report at https://bugs.php.net/bug.php?id=63290&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63290&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63290&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63290&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63290&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63290&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63290&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63290&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63290&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63290&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63290&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63290&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63290&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63290&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63290&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63290&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63290&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63290&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63290&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63290&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63290&r=mysqlcfg