From e1c299133cf05ba9f8d5307eb698d2bf9a6f12e5 Mon Sep 17 00:00:00 2001 From: Gilles Dubuc Date: Wed, 1 Oct 2014 22:55:23 +0200 Subject: [PATCH] Workaround for thumbnail pre rendering with PHP < 5.4.7 Since this code is dealing with scheme-less URLs, parse_url() can cause issues in older versions of PHP. Change-Id: Ic1276feed9ed51772a05c4a73c787a315b848066 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/301 --- includes/jobqueue/jobs/ThumbnailRenderJob.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/jobqueue/jobs/ThumbnailRenderJob.php b/includes/jobqueue/jobs/ThumbnailRenderJob.php index ec68d7ef4e..6b1e7e35ca 100644 --- a/includes/jobqueue/jobs/ThumbnailRenderJob.php +++ b/includes/jobqueue/jobs/ThumbnailRenderJob.php @@ -81,6 +81,10 @@ class ThumbnailRenderJob extends Job { $thumbUrl = $file->getThumbUrl( $thumbName ); if ( $wgUploadThumbnailRenderHttpCustomDomain ) { + // Workaround for parse_url not handling scheme-less urls properly in PHP < 5.4.7 + if ( substr( $thumbUrl, 0, 2 ) === '//' ) { + $thumbUrl = 'http:' . $thumbUrl; + } $thumbUrl = '//' . $wgUploadThumbnailRenderHttpCustomDomain . parse_url( $thumbUrl, PHP_URL_PATH ); } -- 2.20.1