MimeAnalyzer::doGuessMimeType() uses XmlTypeCheck to find the type of a file. When the file does not contain XML data (e.g JPEG data) the following is emitted:
PHP Warning: XMLReader::open(): Unable to open source data
Surrounding the call to XmlTypeCheck with
MediaWiki\suppressWarnings(); $xml = new XmlTypeCheck( $file ); MediaWiki\restoreWarnings();
solves the problem.