Fix deprecated error message for LYS in PHP 8.1 environment (#46661)

* Fix deprecated error with strlen when using PHP 8.1

* Changelog
This commit is contained in:
Ilyas Foo 2024-04-18 05:45:13 +08:00 committed by GitHub
parent 9e0fab4ebc
commit d2c4490c92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix deprecated error message with strlen usage in PHP 8.1

View File

@ -236,7 +236,7 @@ class WCAdminHelper {
private static function get_normalized_url_path( $url ) {
$query = wp_parse_url( $url, PHP_URL_QUERY );
$path = wp_parse_url( $url, PHP_URL_PATH ) . ( $query ? '?' . $query : '' );
$home_path = wp_parse_url( site_url(), PHP_URL_PATH );
$home_path = wp_parse_url( site_url(), PHP_URL_PATH ) ?? '';
$normalized_path = trim( substr( $path, strlen( $home_path ) ), '/' );
return $normalized_path;
}