php-phantomjs
php-phantomjs copied to clipboard
Valid URLs throwing exception - v4.6
AbstractRequest.php uses the following code to setURL in version 4.6
public function setUrl($url)
{
if (!filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
throw new InvalidUrlException(sprintf('Invalid URL provided: %s', $url));
}
$this->url = $url;
return $this;
}
The problem with using filter_var method to valid the URL is that it is rejecting valid URLs. For example..
http://www.example.com/contact?target=+axQx/+PAHlYLNsKRSfFU+ls7e3lKW4nA3ETM25sDHk&name=Test URL&referrer=node/82413
I did a little research and filter_var seems like it's not that great of a function for the intended purpose here. If you wish to keep the check in I have seen others recommend Symfony Validator.. https://github.com/symfony/Validator/blob/master/Constraints/UrlValidator.php