• Resolved CyberBengt

    (@cyberbengt)


    I get this error message after I upgraded to PHP 7.2:
    Warning: count(): Parameter must be an array or an object that implements Countable in /home/unitrafo/public_html/wp-content/plugins/download-monitor/includes/product/class-dlm-product-manager.php on line 137

    What to do?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter CyberBengt

    (@cyberbengt)

    After downgrading to PHP 7.1 the error message disappeared

    • This reply was modified 6 years, 3 months ago by CyberBengt.
    Thread Starter CyberBengt

    (@cyberbengt)

    After downgrading to PHP 7.1 the error message disappeared

    Hello Guys We had the same issue for a client today, and this error message is linked to the fact that in PHP 7.2 the count function needs the first parametter to be an array variable. Php 7.2 requires indicating variables as an array properly such: $myarray() and not like this $myarray = … , but in the code it is not done as such.

    So the fix is to edit the file:

    /wp-content/plugins/download-monitor/includes/product/class-dlm-product-manager.php on row 137

    and change this code:

    // loop products
    		if ( count( $products ) > 0 ) {
    			foreach ( $products as $product ) {

    To this code:

    // loop products
    		if ( $products > 0 ) {
    			foreach ( $products as $product ) {

    Have fun 🙂

    Franck
    WordPress Peacekeeper

    • This reply was modified 6 years, 3 months ago by JungleWP.

    Hey Franck,

    Thanks for sharing the details. Currently, we are working on a major update “Download Monitor 4.0” which should be released within next few weeks. If any of you would like to do beta testing, please do email us at “support@download-monitor.com”.

    This issue should be resolved in this upcoming version.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error message after upgrading to PHP 7.2’ is closed to new replies.