$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;
+ $parsedUrl = wfParseUrl( $thumbUrl );
+
+ if ( !$parsedUrl || !isset( $parsedUrl['path'] ) || !strlen( $parsedUrl['path'] ) ) {
+ return false;
}
- $thumbUrl = '//' . $wgUploadThumbnailRenderHttpCustomDomain . parse_url( $thumbUrl, PHP_URL_PATH );
+
+ $thumbUrl = '//' . $wgUploadThumbnailRenderHttpCustomDomain . $parsedUrl['path'];
}
wfDebug( __METHOD__ . ": hitting url {$thumbUrl}\n" );