Page MenuHomePhabricator

Undefined index in Score::generateHTML
Closed, ResolvedPublic

Description

Undefined index: <some image filename> in /srv/mediawiki/php-1.28.0-wmf.14/extensions/Score/Score.body.php on line 441

https://github.com/wikimedia/mediawiki-extensions-Score/blob/master/Score.body.php#L441

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 15 2016, 11:54 PM
demon added a subscriber: demon.Aug 16 2016, 12:00 AM

Looks like this can happen when $existingFiles[$imageFileName] is set but $metaData[$imageFileName] is not. I mean we could easily check for isset() and throw exceptions or something, but it seems a little deeper than that. Someone who knows this extension should have a look.

Ebe123 claimed this task.Dec 4 2017, 2:45 AM
Ebe123 moved this task from Backlog to In Progress on the MediaWiki-extensions-Score board.
Ebe123 added a subscriber: Ebe123.

I'm getting this error after disabling SVG in Vagrant. The PNGs are used in its place, but as the size values in the metadata file are for the vector file, it fails to find the PNG size. There must always be a metadata file, as without one, the score is regenerated (always with one), but if it exists, there are no checks for equivalence. Fixing this part, I added a check for the size in the logic for whether to generate the files. The file is then re-made. I can't find any way for the data to be wrongly stored.

The issue was introduced with rESCRcc6a86d0c084: Pass length of ogg file to TimedMediaTransformOutput, part of the fix for T49533, but without any mention of the addition of image dimension calculation. However, they check for the length value, and re-generate if not found. The fix seems to just be to force regeneration if not found.

There also shouldn't be such problems with SVG. As the dimensions are embedded in the image file itself, if the value is needed (needless to say, there had been no discussion that it was needed for PNG), it can be found from within, removing a step where things can go wrong. I'll just make myself a note to remove its use with images in T49578: Score should output SVG. I've also made T181958: TimedMediaHandler should handle OGG/Vorbis length efficiently to get rid of the metadata file in its entirety.

Change 394909 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/Score@master] Check for PNG metadata before generating HTML

https://gerrit.wikimedia.org/r/394909

Change 394909 merged by jenkins-bot:
[mediawiki/extensions/Score@master] Check for PNG metadata before generating HTML

https://gerrit.wikimedia.org/r/394909

Ebe123 closed this task as Resolved.Jan 12 2018, 3:03 AM

Shouldn't happen anymore with the fix.