serendipity_event_usergallery - PHP Warning: count()

Found a bug? Tell us!!
Post Reply
Posts: 2
Joined: Fri Oct 15, 2010 2:49 pm

serendipity_event_usergallery - PHP Warning: count()

Post by delakut » Tue Jun 23, 2020 11:33 am

I get a php warning for the serendipity_event_usergallery plugin. I have php 7.3. The php warning is
[Tue Jun 23 10:46:34.462114 2020] [php7:warn] [pid 25309] [client] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/serendipity/templates_c/default/47/66/de/4766def$766defdc3de7086bc2441be5daebffb5ec685f9_0.file.plugin_usergallery_imagedisplay.tpl.php on line 133
I think the warning has to do with count() in line 65 in plugin_usergallery_imagedisplay.tpl:

Code: Select all

{if count($plugin_usergallery_file.staticpage_results) > 0}
A solution could be

Code: Select all

{if is_array($plugin_usergallery_file.staticpage_results) && count($plugin_usergallery_file.staticpage_results) > 0}
The same for line 56.

User avatar
Posts: 2495
Joined: Tue Sep 09, 2008 10:04 pm

Re: serendipity_event_usergallery - PHP Warning: count()

Post by onli » Tue Jun 23, 2020 5:38 pm

Yes, that looks like a correct fix. It would be great if you could test it and then send a PR to I'm not aware of a developer that runs or maintains that plugin.

Post Reply