Page MenuHomePhabricator

Uploader information is wrong
Closed, ResolvedPublic

Description

Author: Bryan.TongMinh

Description:
http://commons.wikimedia.org/wiki/Image:Escudo_de_Toledo.svg

The API tells that the uploader of the older version of this image is anonymous, while that clearly isn't the case.


Version: 1.11.x
Severity: normal
URL: http://commons.wikimedia.org/w/api.php?action=query&titles=Image:Escudo%20de%20Toledo.svg&prop=imageinfo&iihistory&iiprop=timestamp|user|url&format=jsonfm

Details

Reference
bz11072

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:49 PM
bzimport set Reference to bz11072.

Well, this is suspicious:

Notice: Undefined property: stdClass::$img_timestamp in /opt/web/pages/trunk/includes/api/ApiQueryImageInfo.php on line 73

Notice: Undefined property: stdClass::$img_user_text in /opt/web/pages/trunk/includes/api/ApiQueryImageInfo.php on line 75

Notice: Undefined property: stdClass::$img_user in /opt/web/pages/trunk/includes/api/ApiQueryImageInfo.php on line 76

Looks like it's looking at oldimage rows incorrectly.

Bryan.TongMinh wrote:

Fix for this bug

Yeah, the prefix for the first row is img_; for all others it's oi_. In includes/ImagePage.php this appears to be fixed by just duplicating code. I don't think there is another way to do so. I have attached a diff, but I think it is quite ugly.

Attached:

Reassigning to Yuri, since the imageinfo module is one of the many modules that was moved from query.php, which was mainly maintained by Yuri in the first place.

Fixed in r25212, with a slightly different workaround to avoid the duplicate code.

The LocalFile::nextHistoryLine() interface changed recently to return the original column names from the oldimage table instead of aliasing them to the image table column names.

That entire interface is dreadful:

  • It embeds iterative state information in the image data object
  • It returns raw database contents in a fairly ugly, fragile way (hence breakage when details changed)
  • Ewwwwwwww :)