Page MenuHomePhabricator

Internal error in ApiFormatRaw::getMimeType
Closed, ResolvedPublic


Error: Exception Caught: Internal error in ApiFormatRaw::getMimeType: No MIME type set for raw formatter

I was messing around with the API, when I got this error. The the fact that the query is non-functional is almost certainly the result of me throwing it a nonsensical combination of inputs, but even so, the API should probably fail more gracefully.


Version: 1.18.x
Severity: minor



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:30 PM
bzimport set Reference to bz28002.

Personally, I'm not sure it's something that is needed to fail more gracefully, or at least, not where the error is coming from

		if ( !isset( $data['mime'] ) ) {
			ApiBase::dieDebug( __METHOD__, 'No MIME type set for raw formatter' );

That looks sane. If the set of options you are providing are indeed rubbish (ie no output should be given for them), then that does want looking at and potentially protecting against.

title --> titles make it play nicely

Looks like ApiQuery isn't checking for existence of at least 1 of the following titles/pageids/revids

Bleh, ApiPageSet

		// Only one of the titles/pageids/revids is allowed at the same time
		$dataSource = null;
		if ( isset( $params['titles'] ) ) {
			$dataSource = 'titles';
		if ( isset( $params['pageids'] ) ) {
			if ( isset( $dataSource ) ) {
				$this->dieUsage( "Cannot use 'pageids' at the same time as '$dataSource'", 'multisource' );
			$dataSource = 'pageids';
		if ( isset( $params['revids'] ) ) {
			if ( isset( $dataSource ) ) {
				$this->dieUsage( "Cannot use 'revids' at the same time as '$dataSource'", 'multisource' );
			$dataSource = 'revids';

And then

		switch ( $dataSource ) {


				// Do nothing - some queries do not need any of the data sources.

So we need a way to track for the export if we haven't specified a title when we needed to...

Though, it does do

		// only export when there are titles
		if ( !count( $exportTitles ) ) {

It probably should just fail/do more like what does, giving "<api />"