[PATCH] Validate::url
| From: | Davey | Date: | Fri, 05 Dec 2003 03:54:23 +0000 |
| Subject: | [PATCH] Validate::url | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-24167@lists.php.net to get a copy of this message | ||
Hey,
Following the discussion [1] I decided to look in to
Validate myself, please find here [2] a patch for a
much (IMO) improved validate::url method.
The new method does the following, in this order:
1. Checks the given URI is valid within the RFC2396 spec.
2. If specific allowed protocols are defined in the new 3rd arg,
it checks its one of those allowed
3. If the second arg is TRUE, and the host OS is *nix, it will check
the DNS, on windows, this doesn't happen as checkdnsrr() is *nix only.
This can create different results on windows and *nix. If the first two
checks are valid and the domain does NOT exist, on windows it will return TRUE because it cannot check, *nix will return FALSE.
I ran 10 tests, all yielded the results I expected on both Windows and *nix
- Davey
[1] http://marc.theaimsgroup.com/?l=pear-dev&m=107055121202742&w=2
[2] http://davey.is-a-geek.com/php-cvs/diffs/PEAR/Validate.txt