Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -307,16 +307,24 @@ |
308 | 308 | |
309 | 309 | return $result; |
310 | 310 | } else { // result for counting or debugging is just a string |
311 | | - if ( array_key_exists( 'intro', $params ) ) { |
312 | | - $res = str_replace( '_', ' ', $params['intro'] ) . $res; |
| 311 | + if ( is_string( $res ) ) { |
| 312 | + if ( array_key_exists( 'intro', $params ) ) { |
| 313 | + $res = str_replace( '_', ' ', $params['intro'] ) . $res; |
| 314 | + } |
| 315 | + if ( array_key_exists( 'outro', $params ) ) { |
| 316 | + $res .= str_replace( '_', ' ', $params['outro'] ); |
| 317 | + } |
| 318 | + |
| 319 | + $result = $res . smwfEncodeMessages( $query->getErrors() ); |
313 | 320 | } |
314 | | - if ( array_key_exists( 'outro', $params ) ) { |
315 | | - $res .= str_replace( '_', ' ', $params['outro'] ); |
| 321 | + else { |
| 322 | + // When no valid result was obtained, $res will be a SMWQueryResult. |
| 323 | + $result = smwfEncodeMessages( $query->getErrors() ); |
316 | 324 | } |
317 | | - |
| 325 | + |
318 | 326 | wfProfileOut( 'SMWQueryProcessor::getResultFromQuery (SMW)' ); |
319 | | - |
320 | | - return $res . smwfEncodeMessages( $query->getErrors() ); |
| 327 | + |
| 328 | + return $result; |
321 | 329 | } |
322 | 330 | } |
323 | 331 | |