KWPro.net

Zend_Validate_Hostname: Not for Validating URLs
By: conark
Published On: 2-2-2011

I learned the hard way that Zend_Validate_Hostname really isn't meant to validate URLs.  It's mostly to validate just the hostname.  Surprisingly, there are no classes in the Zend Validate section which is capable of validating a URL (unless I'm absolutely wrong about this class; if I am, then the class is foobar'd because the regular expression it uses to grab the TLD is wrong if you have a url like http://www.blah.com/blah/1213/13123/sdfsdfsf/sdfsdf). Fortunately, I found a site that had a simple, easy to use URL validator.  Unfortunately, because it's not incorporated into the main framework, this situation does imply you having to copy the file each time.

On a side note, one of the unrelated benefits I discovered whilst debugging this issue was a horrible error in my code.  So all wasn't lost....maybe even in better because it unveiled a nasty hole in my logic.

AddThis Social Bookmark Button Sphere: Related Content

Trackbacks: (Trackback URL)

No Comments Posted Yet
July [August] September
Sun Mon Tue Wed Thu Fri Sat
31 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 1 2 3