File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -521,7 +521,8 @@ public static function pathToUrl($path)
521521 */
522522 public static function isAbsolute ($ path )
523523 {
524- $ result = preg_match ('#^(?:[a-z-]+:|\/\/)#i ' , $ path );
524+ $ result = strpos ($ path , '// ' ) === 0
525+ || preg_match ('#^[a-z-]{3,}:\/\/#i ' , $ path );
525526
526527 return $ result ;
527528 }
Original file line number Diff line number Diff line change @@ -172,7 +172,12 @@ public function testIsAbsolute()
172172 isTrue (Url::isAbsolute ('https://site.com ' ));
173173 isTrue (Url::isAbsolute ('http://site.com ' ));
174174 isTrue (Url::isAbsolute ('//site.com ' ));
175+ isTrue (Url::isAbsolute ('ftp://site.com ' ));
176+
175177 isFalse (Url::isAbsolute ('/path/to/file ' ));
178+ isFalse (Url::isAbsolute ('w:/path/to/file ' ));
179+ isFalse (Url::isAbsolute ('W:/path/to/file ' ));
180+ isFalse (Url::isAbsolute ('W:\path\to\file ' ));
176181 }
177182
178183 public function testEmpty ()
You can’t perform that action at this time.
0 commit comments