Page MenuHomePhabricator

If $wgImageLimits is less than three it crashes
Closed, ResolvedPublic

Description

Author: dodgy

Description:
This works fine:
$wgImageLimits = array (
array(800,600),
array(800,600),
array(800,600) );

But less than two options crashes

This crashes:
$wgImageLimits = array (
array(800,600),
array(800,600) );

So does this:
$wgImageLimits = array ( array(800,600) );

The error happens when one views an "Image:" page (image namespace)

"Division by zero" in "ImagePage.php on line 205"

Then two "Warning: Cannot modify header information - headers already sent by " on "WebResponse.php on
line 9"

Also the image in the Image: namespace doesn't show, but clicking on the link will view it.


Version: 1.9.x
Severity: normal
OS: Windows 98
Platform: PC

Details

Reference
bz8858

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:31 PM
bzimport set Reference to bz8858.
bzimport added a subscriber: Unknown Object (MLST).

The user preference save an offset in the array, in your case the
offset is out of the array. We should save the (x,y) couple instead.

When tweaking $wgImageLimits, the default preference should be changed too.

Example:

$wgImageLimits = array(

array(320,240),

);
$wgDefaultUserOptions['imagesize'] = 0;

Anyway, I added a check in image page to make sure the offset actually exist
and default to the last offset if not. I also added some documentation in
DefaultSettings.php

Fixed in r19725

dodgy wrote:

Ah, you know that would be nice if I removed as skin as a selectable skin that it would get it out of
user preferences, too.