r106515 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106514‎ | r106515 | r106516 >
Date:18:29, 17 December 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fix fatal error in some cases
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
@@ -1,4 +1,5 @@
22 <?php
 3+
34 /**
45 * @file
56 * @ingroup SMWSpecialPage
@@ -11,13 +12,6 @@
1213 * @author Daniel Herzig
1314 */
1415
15 -if ( !defined( 'MEDIAWIKI' ) ) {
16 - die( 'Not an entry point.' );
17 -}
18 -
19 -global $wgAjaxExportList;
20 -$wgAjaxExportList[] = "smwfGetValues";
21 -
2216 /**
2317 * This special page for Semantic MediaWiki implements a
2418 * view on a relation-object pair,i.e. a typed backlink.
@@ -28,6 +22,7 @@
2923 * @ingroup SpecialPage
3024 */
3125 class SMWSearchByProperty extends SpecialPage {
 26+
3227 /// string Name of the property searched for
3328 private $propertystring = '';
3429 /// SMWPropertyValue The property that is searched for
@@ -207,7 +202,7 @@
208203 $html .= '&#160;&#160;' . SMWInfolink::newBrowsingLink( '+', $result[0]->getLongWikiText() )->getHTML( smwfGetLinker() );
209204 }
210205
211 - if ( is_object( $result[1] ) && ( ( $this->value != $result[1] ) || $highlight ) ) {
 206+ if ( array_key_exists( 1, $result ) && is_object( $result[1] ) && ( ( $this->value != $result[1] ) || $highlight ) ) {
212207 $html .= " <em><small>(" . $result[1]->getLongHTMLText( smwfGetLinker() ) . ")</small></em>";
213208 }
214209
@@ -382,7 +377,14 @@
383378 $ret = array();
384379
385380 while ( $result ) {
386 - $ret[] = array( $result[0]->getNextDataValue(), $result[1]->getNextDataValue() );
 381+ $r = array( $result[0]->getNextDataValue() );
 382+
 383+ if ( array_key_exists( 1, $result ) ) {
 384+ $r[] = $result[1]->getNextDataValue();
 385+ }
 386+
 387+ $ret[] = $r;
 388+
387389 $result = $results->getNext();
388390 }
389391