From 459d31c9c8ed40314cf4115e4ea9ea68b7fc76a5 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Fri, 11 Jan 2019 00:08:07 +0000 Subject: [PATCH] Fix SVG metadata handler by changing offset from -1 to 0 Starting in php 7.1, negative offsets are supported in file_get_contents. Previously they were not (and in fact, the php docs said -1 was the default value for the offset if unspecified). The result of this, is starting in php 7.1, MediaWiki could not determine the aspect ratio of SVG files that were larger than 256kb. Follows up e6de99be Bug: T213501 Change-Id: I565e51cd8131542b9a70da49e9cc36c5594ecda3 --- includes/media/SVGMetadataExtractor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index ca398ff14f..f8b0c3c9c0 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -74,7 +74,7 @@ class SVGReader { if ( $size > $wgSVGMetadataCutoff ) { $this->debug( "SVG is $size bytes, which is bigger than $wgSVGMetadataCutoff. Truncating." ); - $contents = file_get_contents( $source, false, null, -1, $wgSVGMetadataCutoff ); + $contents = file_get_contents( $source, false, null, 0, $wgSVGMetadataCutoff ); if ( $contents === false ) { throw new MWException( 'Error reading SVG file.' ); } -- 2.20.1