function getid3_write_id3v2::IsValidURL() too restrictive

Think you found a bug in getID3()? Post here with details.
Post Reply
fred727
User
Posts: 11
Joined: Wed Jun 08, 2016 6:20 pm
Are you a spambot?: no

function getid3_write_id3v2::IsValidURL() too restrictive

Post by fred727 » Wed Jun 08, 2016 6:32 pm

version: 1.9.12
php: 7

1) Don't allow new hostnames with extentions > 3 characters. (an so, don't allow hostnames like "localhost" or "x.localhost" for test...)
2) Don't allow character "," or "%" in path... Realy too restrictive here.

---> So it is impossible to use such URL in mp3 id3v2.3 tags (W???, etc...)

I replaced this function by this one (I think control must be done before user called the library, not by the library itself) :

Code: Select all

	public function IsValidURL($url, $allowUserPass=false) {
		return (bool) $url;
	}

PS: it would be nicer if this fonction was static ;)

James Heinrich
getID3() v1 developer
Posts: 1427
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: function getid3_write_id3v2::IsValidURL() too restrictiv

Post by James Heinrich » Wed Jun 08, 2016 6:43 pm

It would be good to have perfect URL validation, but for now I have relaxed the validation checks. Not quite as much as your example, but it shouldn't reject any valid URL.
https://github.com/JamesHeinrich/getID3 ... 6590d6175c

fred727
User
Posts: 11
Joined: Wed Jun 08, 2016 6:20 pm
Are you a spambot?: no

Re: function getid3_write_id3v2::IsValidURL() too restrictiv

Post by fred727 » Wed Jun 08, 2016 7:02 pm

Perfect !

If you want to test a minimum, you could use this regexp I think. But your solution is OK.

Code: Select all

preg_match('#^([a-z][a-z0-9]*)://[^ ]+$#i', $url)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest