Ticket #521 (closed Bug: fixed)
prep_url() fails on valid URL
| Reported by: | mikexstudios | Owned by: | Geert |
|---|---|---|---|
| Priority: | major | Milestone: | 2.1.2 |
| Component: | Libraries:Validation | Version: | SVN HEAD |
| Keywords: | validation prep_url | Cc: |
Description
From r2344, the Validation library's prep_url function is flawed in that valid URLs are not returned (the function only returns corrected URLs; valid URLs are never returned).
I recommend modifying the function to include a 'return $str' at the very end:
/**
* Filter: prep_url. Prepares a URL for valid::url().
*
* @param string possibly incomplete URL
* @return string
*/
public function prep_url($str = '')
{
if ($str === '' OR $str === 'http://' OR $str === 'https://')
return '';
if (substr($str, 0, 7) !== 'http://' AND substr($str, 0, 8) !== 'https://')
return 'http://'.$str;
//Otherwise, URL is complete:
return $str;
}
Change History
Note: See
TracTickets for help on using
tickets.
