serendipity_event_usergallery - PHP Warning: count()

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

serendipity_event_usergallery - PHP Warning: count()

Post by delakut »

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 54.36.148.245:37370] 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.
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: serendipity_event_usergallery - PHP Warning: count()

Post by onli »

Yes, that looks like a correct fix. It would be great if you could test it and then send a PR to https://github.com/s9y/additional_plugins. I'm not aware of a developer that runs or maintains that plugin.
Post Reply