Skip Menu |

This queue is for tickets about the MediaWiki-API CPAN distribution.

Report information
The Basics
Id: 66605
Status: resolved
Priority: 0/
Queue: MediaWiki-API

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

Bug Information
Severity: Important
Broken in: 0.35
Fixed in: (no value)



Subject: Passing md5 to MediaWiki::API->edit doesn't report an error on fail.
I'm trying to use the 'md5' parameter described here: http://www.mediawiki.org/wiki/API:Edit#Parameters I'm using it like this: $mw-> edit({ action => 'edit', title => $page_title, ## To avoid edit conflicts basetimestamp => $timestamp, text => $new_page_text, summary => "uploading statistics for $page_title", ## Mark the edit as a bot edit. bot => '', ## Guard against encoding corruption (I hope!) ## TODO: make encoding work good md5 => md5_hex($new_page_text), }); When this 'edit' fails, the $mw object returns without an error (I know the edit fails due to the md5 mismatch, because it works when I comment out that line... However, it works when the hashes match as far as I can tell). I'm not quite sure why the hashes fail to match, but the $mw object should throw an error when it does.
Have you tried using the main API function instead of the edit function?
Seems to work ok here. I am unable to reproduce this problem <pre> use MediaWiki::API; my $mw = MediaWiki::API->new(); $mw->{config}->{api_url} = 'http://testwiki.exotica.org.uk/mediawiki/api.php'; my $text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; my $pagename = "Sandbox"; my $timestamp = $ref->{timestamp}; my $ret = $mw->edit( { action => 'edit', title => $pagename, md5 => "72d61cf1392f7c0f55c972ecc6d0d9b4", # wrong md5sum text => $text } ) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; </pre> gives 3: badmd5: The supplied MD5 hash was incorrect at test.pl line 11.
From: dan.bolser [...] gmail.com
Thanks for this test, I'll keep investigating... I'm seeing a few 'bugs' coming from uncaught exceptions from various old version of MediaWiki. I'll rerun my script and see if I can track down the version of MediaWiki that dies 'silently' when the md5s fail to match. Cheers, Dan. On Tue Mar 15 21:51:53 2011, exobuzz wrote: Show quoted text
> Seems to work ok here. I am unable to reproduce this problem > > <pre> > use MediaWiki::API; > > my $mw = MediaWiki::API->new(); > $mw->{config}->{api_url} = > 'http://testwiki.exotica.org.uk/mediawiki/api.php'; > > my $text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, > sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut > enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut > aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit > in voluptate velit esse cillum dolore eu fugiat nulla pariatur. > Excepteur sint occaecat cupidatat non proident, sunt in culpa qui > officia deserunt mollit anim id est laborum."; > > my $pagename = "Sandbox"; > my $timestamp = $ref->{timestamp}; > my $ret = $mw->edit( { > action => 'edit', > title => $pagename, > md5 => "72d61cf1392f7c0f55c972ecc6d0d9b4", # wrong md5sum > text => $text } ) > || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; > </pre> > > gives 3: badmd5: The supplied MD5 hash was incorrect at test.pl line 11.
Setting back to rejected for now, as it seems unreproducible and may well just be a mediawiki issue on older versions.
From: dan.bolser [...] gmail.com
On Wed Mar 16 14:59:56 2011, exobuzz wrote: Show quoted text
> Setting back to rejected for now, as it seems unreproducible and may > well just be a mediawiki issue on older versions.
Really sorry, seems a lot of the issues I was finding were stemming from my incorrect use of the error function. Thanks for your help, Dan.