bug in phoo - allocating all memory

Discussion about developing or modifying gadgets and plugins

bug in phoo - allocating all memory

Postby zzanzare » Fri Jul 02, 2010 11:45 am

I found a bug and also a fix for it, but I was unable to report it using the bugsystem, so I'm reporting it here, please forward it to appropriate places..

When I inserted an image into Phoo gadget, I was then unable to do anything with the whole gallery, because it was firing PHP memory limit exhausted error. I found out it was happening when the image has incorrect EXIF date - 0000:00:00 00:00:00. The gadget was then trying to cycle through all dates to create the album_list combo box, and this made him cycle to infinity and consequently deplete the memory.

the fix is to add one condition to the function, which inserts the image in the album

file: gadgets/Phoo/AdminModel.php
lines 389 - 402, function NewEntry

Code: Select all
        $createtime = MDB2_Date::mdbNow();
        if (function_exists('exif_read_data') &&
            (preg_match("/\.jpg$|\.jpeg$/i", $files['name'])) &&
            ($data = @exif_read_data($uploadfile, 1, true)) &&
            !empty($data['IFD0']['DateTime']) &&
            trim(str_replace("0", "", str_replace(":", "", $data['IFD0']['DateTime']))) // fixes bug when exif date is 0000:00:00 00:00:00
            $aux        = explode(' ', $data['IFD0']['DateTime']);
            $auxdate    = str_replace(':', '-', $aux[0]);
            $auxtime    = $aux[1];
            $createtime = $auxdate . ' ' . $auxtime;
        $params['createtime'] = $createtime;
Posts: 2
Joined: Sun Jan 11, 2009 2:21 pm

Return to Gadgets and Plugins Development

Who is online

Users browsing this forum: No registered users and 2 guests