diff --git a/src/Symfony/Component/DomCrawler/Link.php b/src/Symfony/Component/DomCrawler/Link.php index 31e8ba12f5..dfd8fceaf8 100644 --- a/src/Symfony/Component/DomCrawler/Link.php +++ b/src/Symfony/Component/DomCrawler/Link.php @@ -89,7 +89,7 @@ class Link $uri = trim($this->getRawUri()); // absolute URL? - if (0 === strpos($uri, 'http')) { + if (null !== parse_url($uri, PHP_URL_SCHEME)) { return $uri; } diff --git a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php index 5d40179a53..976082d3ee 100644 --- a/src/Symfony/Component/DomCrawler/Tests/LinkTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/LinkTest.php @@ -93,6 +93,8 @@ class LinkTest extends \PHPUnit_Framework_TestCase array('?a=b', 'http://localhost/bar/', 'http://localhost/bar/?a=b'), array('http://login.foo.com/foo', 'http://localhost/bar/', 'http://login.foo.com/foo'), + array('https://login.foo.com/foo', 'https://localhost/bar/', 'https://login.foo.com/foo'), + array('mailto:foo@bar.com', 'http://localhost/foo', 'mailto:foo@bar.com'), array('?foo=2', 'http://localhost?foo=1', 'http://localhost?foo=2'), array('?foo=2', 'http://localhost/?foo=1', 'http://localhost/?foo=2'),