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
$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 );
}