Skip to content

Commit

Permalink
Fix yiisoft#17181: Improved BaseUrl::isRelative($url) performance
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa authored Jan 6, 2024
1 parent dea891e commit b46e267
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions framework/helpers/BaseUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit b46e267

Please sign in to comment.