Skip to content

PHP warning in WP error log #13

@louptn

Description

@louptn

Getting a recurring warning:
PHP Warning: count(): Parameter must be an array or an object that implements Countable in /public_html/wp-content/plugins/coursepress/2.0/include/coursepress/data/class-course.php on line 1635
PHP Warning: count(): Parameter must be an array or an object that implements Countable in /public_html/wp-content/plugins/coursepress/2.0/include/coursepress/data/class-course.php on line 1637

Relevant lines are the same code:
$part = count( (array)$components > 0 ) ? array_pop( $components ) : 0;

Tried a fix along the lines of:
$part = (array)$components && count( (array)$components > 0 ) ? array_pop( $components ) : 0;

But still having the warning...any thoughts?

Running on WP 5.6 and PHP 7.3.23 (I am running it for a free workbook that can be signed into and worked on and saved, so i have not had to edit courses and don't dare go in there to see if i even could :-) just basically let it be while it works)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions