From: Gilles Dubuc Date: Wed, 1 Oct 2014 20:55:23 +0000 (+0200) Subject: Workaround for thumbnail pre rendering with PHP < 5.4.7 X-Git-Tag: 1.31.0-rc.0~13730^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=e1c299133cf05ba9f8d5307eb698d2bf9a6f12e5;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ); }