Tidypics Plugin Version 2.0.1 - PHP Error Log Warnings - Uploading Multiple Pictures

I'm using the Elgg Developer Tools Plugin, my trace level is on warning. I'm curious if this is a known thing. When uploading one picture to an album I don't get the warnings. The warnings only happen when I try to upload multiple pictures using the ajax upload form (Plupload). This is how the warnings look like. 

[14-Sep-2016 21:13:55 America/New_York] WARNING: PHP: 2016-09-14 21:13:55 (EDT): "array_merge(): Argument #2 is not an array" in file /usr/local/elgg/2.1.1/mod/tidypics/lib/exif.php (line 28)

[14-Sep-2016 21:13:55 America/New_York] WARNING: PHP: 2016-09-14 21:13:55 (EDT): "Invalid argument supplied for foreach()" in file /usr/local/elgg/2.1.1/mod/tidypics/lib/exif.php (line 29)

[14-Sep-2016 21:13:55 America/New_York] WARNING: PHP: 2016-09-14 21:13:55 (EDT): "array_intersect_key(): Argument #1 is not an array" in file /usr/local/elgg/2.1.1/mod/tidypics/lib/exif.php (line 42)

[14-Sep-2016 21:13:55 America/New_York] WARNING: PHP: 2016-09-14 21:13:55 (EDT): "array_merge(): Argument #2 is not an array" in file /usr/local/elgg/2.1.1/mod/tidypics/lib/exif.php (line 44)

[14-Sep-2016 21:13:55 America/New_York] WARNING: PHP: 2016-09-14 21:13:55 (EDT): "Invalid argument supplied for foreach()" in file /usr/local/elgg/2.1.1/mod/tidypics/lib/exif.php (line 45)

So far everything it is working great. Although I do have concerns for users using the "Display EXIF data"  feature. 

 

  • I hadn't noticed such warnings before. But there is some faulty code in exif.php indeed that I will have to fix.

    Nevertheless, there are only warnings and no errors. The faulty code might result in some exif data not getting handled / extracted from the image files (and therefore not displayed when on the site when viewing these images) but the image files themselves are not modified anyway, so there is no damage done (apart from the warnings filling the log).

    Are you sure that you get these warnings only when uploading multiple images at once? Don't you get the same warnings when uploading the same pictures separately one by one?

  • Yeah, one by one you don't get any warnings. The warnings only come up when you do more than one picture. You are absolutely right, these are only warnings. I wanted to make sure I was not doing something wrong hence the reason for such warnings.

    I'm very impressed with the tidypics plugin, quite the work has been done in this plugin. So far I have only I have only scratched the surface since I haven't even started to use ImageMagick.

  • After my tests I got the opposite results, i.e. the warnings occur regardless if uploaded a single image or uploaded the same image together with others. The warnings occur on extracting the exif info from the image file not taking into account that not every image has a full set of exif data embedded. The retrieval of exif data happens in the same way regardless of an image uploaded alone or in a set of others.

    I've fixed the issue. Now there's a check on existence of the different sections of exif data before the data is used (or not used if the check on existence turned out to be negative). The necessary changes for the warnings to stop are in a single file (https://github.com/iionly/tidypics/blob/master/lib/exif.php).

    Before I can make a new release of Tidypics I need to wait on the outcome of an Elgg core issue (https://github.com/Elgg/Elgg/issues/10199) and possibly then after the next Elgg core version has been released. In the meantime you can simply replace the exif.php lib with the updated version I've linked and you should no longer get these warnings.

  • iionly,

    I am going to do what you suggested. I will provide feedback. 

  • I tested it with one and more than one, up to 4 photos. No more warnings. I backed up the existing exif file and replaced it with the one you provided. I am going to start getting into that habit as well, checking the existence of key variables used in arrays.