Closed malberts closed 2 years ago
WIP beacause we need to confirm the limitation of using filter_var( $object, FILTER_VALIDATE_URL )
.
https://www.php.net/manual/en/filter.filters.validate.php
Validates value as URL (according to » http://www.faqs.org/rfcs/rfc2396), optionally with required components. Beware a valid URL may not specify the HTTP protocol http:// so further validation may be required to determine the URL uses an expected protocol, e.g. ssh:// or mailto:. Note that the function will only find ASCII URLs to be valid; internationalized domain names (containing non-ASCII characters) will fail.
In practice this might already be good enough. Not catching some obscure stuff is already much better than letting in random junk.
But yeah, good to double-check with the stakeholders what they want exactly.
Perhaps using the same validation as Wikibase has for its URL data type makes sense. https://github.com/wikimedia/Wikibase/blob/master/repo/WikibaseRepo.datatypes.php#L342-L348
This should be good enough now by using Wikibase URL validation.
Refs #95
UI:
API: