image property error with math divison by zero

Found a bug? Tell us!!
Post Reply
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

image property error with math divison by zero

Post by Timbalu »

With an updated Serendipity Blog to 1.6, I just experienced funny things going on within the media library. There where some pictures without any extension, declared to be missed. (If they have been there before, I dont know) I renamed them via ftp and could happily have them restored.

But now the first one in row threw an error when trying to re-edit its properties.
Warning: Division by zero in /home/..../serendipity/include/functions_images.inc.php on line 2898

This may have to do with its size, or may consider being flawed as to be one of the restored images.
picture2.jpg [image/jpeg]
on 2011-10-31 07:18. Orig.: 1280x960, Thumb: 110x83 (208.00kb)

I solved it by adding if($parts[1] > 0) to that line:

Code: Select all

            if($parts[1] > 0) return ($parts[0] / $parts[1]);
This may be just a very individual bug, as this blog came up from ~1.0.2 to 1.5.5 and now 1.6.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply