suffusion icon indicating copy to clipboard operation
suffusion copied to clipboard

PHP Warning: count()

Open Ciprian-Dracea opened this issue 1 year ago • 1 comments

Hi Marc,

First of all, thank you for keeping Suffusion up and running. I didn't had time to write here, but I was very happy seeing you updating and fixing bugs of the theme. Thank you.

Now, an annoying thing. On one of the sites which still use Suffusion, the server drop in error.log at every minute this line: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/........./public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 113

In few months error.log become huge and the hosting company ask for more money for allowing more space.

I replaced the line 113 from if (count($solo_tags) > 0) { to if (!is_null($solo_tags)) {

and the site stop filling "error.log".

If the change is ok, please add it in the future updates of the theme or maybe you come with a better solution.

Thank you very much, Drake

Ciprian-Dracea avatar Sep 20 '24 21:09 Ciprian-Dracea

Hi Drake,

you're very welcome. Taking over maintenance only works if the code has few bugs which is the case in this plugin. :-)

That doesn't mean there aren't any bugs, so thanks for reporting this one!

The fix is different than you suggested since you should be able to mention several tags separated by a comma (same as for post ids). Could you please test https://github.com/sayontan/suffusion/pull/91?

Cheers, Marc

marcissimus avatar Sep 21 '24 21:09 marcissimus

Hi all, out of curiosity how is this bug reproduce? I checked my log files and I don't see any PHP warning counts like the one mentioned by Drake above.

Kind regards, Manuel

mbrsolution avatar Sep 30 '24 22:09 mbrsolution

It should occur if you use a tag or tags in the widget

mbtools avatar Oct 01 '24 01:10 mbtools

Well, I tried everything I could think of and could not get a tag to appear in a widget. Maybe I need to go back to WordPress school :)

Kind regards, Manuel

mbrsolution avatar Oct 06 '24 00:10 mbrsolution

There's a tag field in the "post search" widget.

Here it is in German:

image

mbtools avatar Oct 06 '24 20:10 mbtools

Hi,

I installed the latest version of theme on the site with problem and now I get another bulk of warnings: [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "selected_category" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 26 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "icon_type" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 28 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "cat_icon_url" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 29 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "post_style" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 30 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "post_thumbnail_size" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 31 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "post_excerpt_length" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 32 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "number_of_posts" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 33 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "icon_height" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 34 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "icon_width" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 35 [16-Oct-2024 21:44:27 UTC] PHP Warning: Undefined array key "all_posts_text" in /home/.../public_html/wp-content/themes/suffusion/widgets/suffusion-query-posts.php on line 36

Thank you for looking into this, Ciprian

Ciprian-Dracea avatar Oct 16 '24 22:10 Ciprian-Dracea

@Ciprian-Dracea Can you test if https://github.com/sayontan/suffusion/pull/93 fixes this?

marcissimus avatar Oct 16 '24 23:10 marcissimus

Yes, thank you Marc. The changes solved the problem and the error log is clean.

Thank you, Ciprian

Ciprian-Dracea avatar Oct 17 '24 21:10 Ciprian-Dracea