diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 0a95132681a..7296c02cd3d 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 2.0.50 under development ------------------------ +- Bug #17181: Improved `BaseUrl::isRelative($url)` performance (sammousa, bizley, rob006) - Bug #17191: Fixed `BaseUrl::isRelative($url)` method in `yii\helpers\BaseUrl` (ggh2e3) - Bug #18469: Fixed `Link::serialize(array $links)` method in `yii\web\Link` (ggh2e3) - Bug #20040: Fix type `boolean` in `MSSQL` (terabytesoftw) diff --git a/framework/helpers/BaseUrl.php b/framework/helpers/BaseUrl.php index dcbab192730..864dbc63c48 100644 --- a/framework/helpers/BaseUrl.php +++ b/framework/helpers/BaseUrl.php @@ -378,8 +378,7 @@ public static function home($scheme = false) */ public static function isRelative($url) { - $urlComponents = parse_url($url, PHP_URL_SCHEME); - return strncmp($url, '//', 2) && empty($urlComponents); + return preg_match('~^[[:alpha:]][[:alnum:]+-.]*://|^//~', $url) === 0; } /**