bugsnag/bugsnag-php

PHP 7.2: count(): Parameter must be an array or an object that implements Countable

acip opened this issue · 3 comments

acip commented

Description

count(): Parameter must be an array or an object that implements Countable warning is raised.

Issue

        $sessions = $this->getSessionCounts();
        $this->setSessionCounts([]);
        if (count($sessions) == 0) {
            return;
        }

in bugsnag/bugsnag/src/SessionTracker.php:285

Environment

  • bugsnag-php version: 3.19.0
  • PHP version: 7.2

Thanks for the report. Are you using Bugsnag with the Laravel or Symfony library, or natively? This error can only be caused by the function given to setStorageFunction, returning null.

acip commented

Laravel

This has been fixed in version v3.21.0