Getting this error when trying to complete upgrade of Mgaento 2.2.2 (running on PHP7.1) to Magento 2.3.1 (running on PHP 7.2)
1 exception(s): Exception #0 (Exception): Warning: count(): Parameter
must be an array or an object that implements Countable in
/home/mytheme/public_html/app/design/frontend/Sm/topshop/Sm_Deals/templates/default.phtml
on line 16
I managed to fix a lot of errors with researching but stuck with this one.
$start = ($start <= 0 || $start > count($list)) ? 0 : $start - 1;
Best Answer
As of PHP 7.2 this is a warning about a non-Countable object being passed to
count()
:Without any further code to look at (e.g. the code that defines the
$list
variable) or knowing what$list
contains, I would guess that however$list
is defined one of the valid results isnull
. You have two options:$list
before that line and redefine it if necessary:$list
is defined and fix it so it returns only an array or an object that implements theCountable
interface.