[Support request] Warning: count(): Parameter must be an array or an object that implements Count

Home Forums Support [Support request] Warning: count(): Parameter must be an array or an object that implements Count

Home Forums Support Warning: count(): Parameter must be an array or an object that implements Count

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #397978
    John

    Using the GeneratePress Theme 1.4, after activating the GP Premium plugin, Version 1.4.3, the below Warning messages appear at Dashboard > Pages, and at Dashboard > Posts:
    Warning: count(): Parameter must be an array or an object that implements Countable in D:\Server\data\htdocs\2017\wp-admin\includes\template.php on line 1447
    Warning: count(): Parameter must be an array or an object that implements Countable in D:\Server\data\htdocs\2017\wp-admin\includes\template.php on line 1447
    > However, no problems. Everything seems to operate as expected
    &
    > Why I think Generate Press Pro plugin is the cause.
    I created a new install of WordPress 4.8.2. The default theme is 2017. No Warning messages.
    I installed and activated Generate Press Theme 1.4. No Warning messages
    I installed and activated the GP Premium plugin. The Warning messages appeared.
    I deactivated the GP Premium plugin. No Warning messages.
    &
    > I am using Windows 7 Pro 64 bit.
    > “D:\Server\data\htdocs\2017” is the path to the install of WordPress.
    > I am very puzzled because obviously no one else had this problem. I did a search on “Warning” and “Warning:” and “Count()” . I found no other instances of the Warning Messages.

    #398014
    Tom
    Lead Developer
    Lead Developer

    Hmm, haven’t had any other reports of this. I wonder if it’s a server thing.

    Do you have a live server you’ve tested on? It could be due to hosting the site on Windows 7.

    #475686
    Enrico

    I have the same problem in two of my sites that use GP Premium. The other 3 are immune.

    The warning is displayed in the sites if I use Php 7.2.1 with GP premium. With Php 7.1 and GPP there is no problem.
    I have no warning with Php 7.2.1 only when GP Premium plugin is deactivated.

    This is one warning in one of the two sites.

    Warning: count(): Parameter must be an array or an object that implements Countable in /home/jobseeke/public_html/yourcopywriter.it/wp-includes/media.php on line 1206

    If you want to see it I need to activate php 7.2 first.

    #475773
    Tom
    Lead Developer
    Lead Developer

    What if you deactivate all of the GPP modules? Same error?

    #475785
    Enrico

    Hi Tom,
    it is the blog module, now I have disabled it and so I can use PHP 7.2.1 with GPP without having the the warning in the site.

    #475795
    Enrico

    What is strange is that I use GPP with the blog module activated in a third site and I am not having this warning on the third site if I activate php 7.2.1.

    The third site, that is immune, it is the newest. It bore with https, the other two had to be converted to htpps.
    For the moment I don’t remember or notice other difference.

    #477412
    Tom
    Lead Developer
    Lead Developer

    I just updated our development server to PHP 7.2 and I’m not able to reproduce this issue. Can you confirm which pages you’re seeing the warnings on?

    #477724
    Enrico

    If you go to yourcopywriter.it you will see the problem. I can not keep the warning for long time. So if you don’t go there soon I will deactivate the blog module again. In this case we will try again tomorrow for you.

    #477731
    Enrico

    This is the Warning in home page You can see the warnings on all the site’s pages if php 7.2.1 is active with blog module.

    I think you went to sleep, so now I have deactivated again the blog module. Let me know how and when you want to see it.

    #478544
    Tom
    Lead Developer
    Lead Developer

    Looking into this some more – will update ASAP 🙂

    #479233
    Tom
    Lead Developer
    Lead Developer

    Still having trouble reproducing this. Do you have custom sizes added for your featured images in Customize > Layout > Blog > Featured Images?

    #479386
    Enrico

    No I did’ set custom size but when I deselect “infinite scroll” the warning disappeared.
    I set infinite scroll again and so the warning is back.

    You have to exit customize to see the warning.

    This are some of the setting I have when the warning is displayed.

    And this is the export of the blog setting:

    {“excerpt_length”:”25″,”read_more”:”Continua a leggere”,”masonry”:true,”masonry_width”:”width2″,”masonry_most_recent_width”:”width4″,”masonry_load_more”:”+ Altro”,”masonry_loading”:”Caricamento…”,”post_image”:true,”post_image_position”:””,”post_image_alignment”:”post-image-aligned-center”,”post_image_width”:””,”post_image_height”:””,”date”:true,”author”:true,”categories”:false,”tags”:false,”comments”:true,”column_layout”:true,”columns”:”50″,”featured_column”:true,”single_date”:true,”single_author”:true,”single_categories”:false,”single_tags”:false,”infinite_scroll”:true,”infinite_scroll_button”:true,”single_post_image_position”:”inside-content”,”page_post_image_position”:”above-content”}

    #482095
    Tom
    Lead Developer
    Lead Developer

    Haven’t given up on this – just haven’t been able to replicate it yet. Will update you ASAP.

    #482397
    Enrico

    I stopped using masonry since it create one issue of first load alignment on category page with Yoast. (You gave me a code to fix it but it is not good if used with an other plugin I use)

    The side effect of not using masonry is that the warning disapprender on blog and category, even when I use infinite scroll with php 7.2.

    The warning now it is displayed only on some pages, if I use the blog module with infinite scroll and Php 7.2.

    So, try to set also the masonry, to try to replicate the warning and check several pages. I hope this information will help you.

    For me this it is not an issue since I don’t need to use php 7.2. I could stay with php 7.1 for long time.

    I have read somewhere that in php 7.2.3 this warning will not be display on production. I am not sure I understood this correctly but a warning should not be displayed on a production site and I didn’t find a way to stop it.

    #483132
    Tom
    Lead Developer
    Lead Developer

    Found it! Will push out a quick fix this week.

    For now, try adding this:

    add_action( 'after_setup_theme', 'tu_fix_72_warning' );
    function tu_fix_72_warning() {
        add_filter( 'wp_calculate_image_srcset', '__return_empty_array', 20 );
    }
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.