[Mediawiki-l] Strange SpecialSearch.php problem

Jim Hu jimhu at tamu.edu
Wed Sep 12 07:36:17 UTC 2007


In MW 1.9.3 I was getting

PHP Fatal error:  Call to a member function getText() on a non-object

in the showHit method in SpecialSearch.php... but so far only for one  
of the many searches I've tried

	http://ecoliwiki.net/colipedia/index.php/Special:Search? 
search=polymerase&go=Go  (fixed now, see below, but was giving white  
screen of death)

The code around the call that gives the error is:

	$link = $sk->makeKnownLinkObj( $t );
	$revision = Revision::newFromTitle( $t );
	$text = $revision->getText();

and $t is checked with is_null earlier in the method.  rebuildall.php  
didn't help.  I modified the code to:

	$link = $sk->makeKnownLinkObj( $t );
	$revision = Revision::newFromTitle( $t );
	$text = "";
	if (is_object($revision)) $text = $revision->getText();

which revealed a page result with a db error... which I deleted.  But  
I'm wondering if
a) the codebase should include an is_object test on $revision (is  
this fixed in later versions?).
b) I should change the above to make the default text some existing  
error message

Jim
=====================================
Jim Hu
Associate Professor
Dept. of Biochemistry and Biophysics
2128 TAMU
Texas A&M Univ.
College Station, TX 77843-2128
979-862-4054




More information about the MediaWiki-l mailing list