Skip Menu |

This queue is for tickets about the MediaWiki CPAN distribution.

Report information
The Basics
Id: 33682
Status: open
Priority: 0/
Queue: MediaWiki

People
Owner: Nobody in particular
Requestors: wknight8111 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.13
Fixed in: (no value)



Subject: readcat() returns HTML
using readcat() on wikibooks.org (I haven't tested it yet on other wikis) returns the list of pages and some other random HTML markup. For example, running it on an empty category gives: Wikibooks (English)" /> <link rel="copyright" href="http://www.gnu.org/copyleft/fdl.html" /> <link rel="alternate" type="application/rss+xml" title="Wikibooks RSS Feed" href="http://en.wikibooks.org/w/index.php?title=Special:Recentchanges&amp;feed=rss" /> <link rel="alternate" type="application/atom+xml" title="Wikibooks Atom Feed" href="http://en.wikibooks.org/w/index.php?title=Special:Recentchanges&amp;feed=atom" /> <title>Category:Crapola - Wikibooks, collection of open-content textbooks</title> <style type="text/css" media="screen, projection Special:Search/Crapola http://en.wikibooks.org/w/index.php?title=Category:Crapola&amp;action=edit" rel="nofollow http://en.wikibooks.org/w/index.php?title=Category:Crapola&amp;action=purge" rel="nofollow http://en.wikibooks.org/w/index.php?title=Special:Log&amp;type=delete&amp;page=Category:Crapola" rel="nofollow View the category page [c]" accesskey="c Discussion about the content page [t]" accesskey="t You can edit this page. Please use the preview button before saving. [e]" accesskey="e You are encouraged to log in, it is not mandatory however. [o]" accesskey="o Visit the Main Page [z]" accesskey="z Visit the Main Page [z]" accesskey="z The place to find out. The list of recent changes in the wiki. [r]" accesskey="r Support us Find background information on current events About the project, what you can do, where to find things Search Wikibooks [f]" accesskey="f" value="" /> <input type='submit' name="go" class="searchButton" id="searchGoButton" value="Go" title="Go to a page with this exact name if exists" />&nbsp; <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" title="Search the pages for this text" /> </div></form> </div> </div> <div class="portlet" id="p-tb List of all wiki pages that link here [j]" accesskey="j Upload files [u]" accesskey="u List of all special pages [q]" accesskey="q Printable version of this page [p]" accesskey="p wikimedia:Privacy policy Wikibooks:About Wikibooks:General disclaimer
From: gledesma [...] gmail.com
I ran into this bug as well. This appears for categories that have few articles (less than 7, I believe). The readcat() function looks for a closing table tag which is only generated for categories with a lot of articles. In the absence of the table tag, the regex fails, causing readcat() to return all links containing title="" in the links. I've attached a small patch that corrects this. Instead of looking for a closing table tag, it's probably safer to look for the <!-- end content --> comment that trails the main content section.
--- lib/MediaWiki.pm.orig 2008-01-06 02:46:19.000000000 -0800 +++ lib/MediaWiki.pm 2008-03-07 11:36:43.000000000 -0800 @@ -423,7 +423,7 @@ push @subs, (join ":", @a); } } - $res =~ s/.*<h2>Articles in category "$cat"<\/h2>(.*?)<\/table>.*/$1/sg; + $res =~ s/.*<h2>Articles in category "$cat"<\/h2>(.*?)<!-- end content -->.*/$1/sg; while($res =~ /(?<=title=").*?(?=">)/sg) { push @pages, $&; [gledesma@hero MediaWiki-1.13]$ diff -Naur lib/MediaWiki.pm.orig lib/MediaWiki.pm > readcat.patch
From: gledesma [...] gmail.com
Apologies. I submitted a malformed patch (trailing lines) earlier.
--- lib/MediaWiki.pm.orig 2008-01-06 02:46:19.000000000 -0800 +++ lib/MediaWiki.pm 2008-03-07 11:36:43.000000000 -0800 @@ -423,7 +423,7 @@ push @subs, (join ":", @a); } } - $res =~ s/.*<h2>Articles in category "$cat"<\/h2>(.*?)<\/table>.*/$1/sg; + $res =~ s/.*<h2>Articles in category "$cat"<\/h2>(.*?)<!-- end content -->.*/$1/sg; while($res =~ /(?<=title=").*?(?=">)/sg) { push @pages, $&;