Fix #17181: Improved BaseUrl::isRelative($url) performance

This commit is contained in:
Sam
2024-01-06 20:07:05 +01:00
committed by GitHub
parent dea891ed6a
commit b46e2676d3
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -378,8 +378,7 @@ class BaseUrl
*/
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;
}
/**