Page MenuHomePhabricator

function_exists( 'exif_read_data' ) is called more than once
Open, Needs TriagePublic

Description

Noticed while looking at T310013: PHP exif module is unexpectedly required.

It feels a bit odd that we do

/**
 * Determine whether EXIF info can be shown
 */
if ( $wgShowEXIF === null ) {
	$wgShowEXIF = function_exists( 'exif_read_data' );
}

And then in Exif.php do another function_exist for it...

		if ( function_exists( 'exif_read_data' ) ) {
			AtEase::suppressWarnings();
			$data = exif_read_data( $this->file, '', true );
			AtEase::restoreWarnings();
		} else {
			throw new MWException( "Internal error: exif_read_data not present. " .
				"\$wgShowEXIF may be incorrectly set or not checked by an extension." );
		}