['http://example.com/foo', 'http://example.com/bar', FALSE],
['http://example.com', 'http://example.com/bar', FALSE],
['http://example.com/bar', 'http://example.com/bar/', FALSE],
+ // Ensure \ is normalised to / since some browsers do that.
+ ['http://www.example.ca\@example.com', 'http://example.com', FALSE],
+ // Some browsers ignore or strip leading control characters.
+ ["\x00//www.example.ca", 'http://example.com', FALSE],
];
}
* @dataProvider providerTestExternalIsLocalInvalid
*/
public function testExternalIsLocalInvalid($url, $base_url) {
- $this->setExpectedException(\InvalidArgumentException::class);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException(\InvalidArgumentException::class);
+ }
+ else {
+ $this->setExpectedException(\InvalidArgumentException::class);
+ }
UrlHelper::externalIsLocal($url, $base_url);
}