Last modified: 2010-09-08 10:41:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27087, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25087 - Categories with subcats show a fatal error when displayed
Categories with subcats show a fatal error when displayed
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Categories (Other open bugs)
1.17.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-07 09:18 UTC by Arancaytar
Modified: 2010-09-08 10:41 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Arancaytar 2010-09-07 09:18:52 UTC
On displaying a category page that contains sub-categories, my site (running on svn trunk) shows the following fatal PHP error:

Notice: Undefined variable: title in ./includes/CategoryPage.php on line 172

Fatal error: Call to a member function getPrefixedText() on a non-object in ./includes/CategoryPage.php on line 193

On examining the relevant function, the error seems immediately apparent:

  /**
   * Add a subcategory to the internal lists, using a Category object
   */
  function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
    // Subcategory; strip the 'Category' namespace from the link text.
    $this->children[] = $this->getSkin()->link(
      $cat->getTitle(),
      null,
      array(),
      array(),
      array( 'known', 'noclasses' )
    );

    $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
  }

In the last line, the variable $title is used, when it hasn't been defined or passed as an argument. This should probably be replaced by $cat->getTitle(), as earlier in the function.

Making that replacement fixed the error for me.
Comment 1 Chad H. 2010-09-08 10:41:28 UTC
Fixed in r72576.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links