From 662b4d2435a47f90c01221c88c9a8c9ab7d1bbc5 Mon Sep 17 00:00:00 2001 From: Nichita Date: Mon, 9 Dec 2024 15:11:02 +0200 Subject: [PATCH] Refactor `replaceCdnUrl` for PHP 5.6 compatibility --- editor/crop-cache-media.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/editor/crop-cache-media.php b/editor/crop-cache-media.php index 3c6dadb5c..ae920721a 100644 --- a/editor/crop-cache-media.php +++ b/editor/crop-cache-media.php @@ -244,15 +244,13 @@ private function getImgUrlByWpSize( $uid, $size ) { * @param string $imgUrl The original image URL. * @return string The updated image URL with the server domain and without query parameters. */ - private function replaceCdnUrl( - string $imgUrl - ): string { + private function replaceCdnUrl($imgUrl) { $server_domain = site_url(); $parsed_url = parse_url($imgUrl); $img_domain = $parsed_url['scheme'].'://'.$parsed_url['host']; - $path = $parsed_url['path'] ?? ''; + $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; if ($img_domain !== $server_domain) { $imgUrl = str_replace($img_domain, $server_domain, $img_domain.$path);