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
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.' );
}