[Mediawiki-l] Getting non-object error in Title::newFromText

John Straffin john.straffin at duke.edu
Mon Feb 21 18:15:04 UTC 2005


All,

The following error is generated by the following sequence of code:

Error:
Fatal error: Call to a member function on a non-object in 
/var/www/html/internal/wiki/includes/Title.php on line 1196

Begin Code:
(Note: $_SERVER["REMOTE_USER"] = jcstraff)
(in modified User.php)
     $name = $_SERVER["REMOTE_USER"];
     $u = User::newFromName( $name );
(elsewhere in User.php)
function newFromName( $name ) {
     $u = new User();
     $t = Title::newFromText( $name );
     ...
(in Title.php)
/* static */ function &newFromText( $text, $defaultNamespace = 0 ) {
     $fname = 'Title::newFromText';
     ...
     /**
     * Normally, all wiki links are forced to have
     * an initial capital letter so [[foo]] and [[Foo]]
     * point to the same place.
     *
     * Don't force it for interwikis, since the other
     * site might be case-sensitive.
     */
     if( $wgCapitalLinks && $this->mInterwiki == '') {
         $t = $wgContLang->ucfirst( $r );   # # # # # # <== LINE 1196
     } else {
         $t = $r;
     }
:End Code

There are lots of "$r"s throughout Title.php, but they all seem to be used 
temporarily and are set explicitly before each use... I cannot see where 
the "$r" on line 1196 originates. When I comment out this Title.php block, 
the code works fine (with other issues that will be discussed in a later 
email.) Did I find a bug or am I doing something wrong/unnatural/evil/etc.?

- John
-- 
John Straffin -+- Duke Univ OIT Tech Support -+- john.straffin at duke.edu
Need Help? Dial 684-2200 or "Ask for help" @ http://www.duke.edu/online
"Let's do a dance for the computer-genius-man!" -- StrongBad Email #118

() the ascii ribbon campaign against html mail -- http://arc.pasp.de ()
/\                                                                   /\




More information about the MediaWiki-l mailing list