Skip to content

Track Custom Variables error: Warning - count(): Parameter must be an array or an object that implements Countable #16596

@basos9

Description

@basos9

Hello,

It seems that custom variables tracking is not working properly.
The variables are not stored in the databases.
Also with Tracker debug enabled we can see the following error on a tracking request with custom variables

WARNING CustomVariables[2020-10-19 11:52:37 UTC] [e201d] /var/www/matomo/core/Tracker/Request.php(635): Warning - count(): Parameter must be an array or an object that implements Countable - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) [internal function]: Piwik\ErrorHandler::errorHandler(),#1/core/Tracker/Request.php(635),#2/core/Tracker/Action.php(191),#3/plugins/CustomVariables/Tracker/CustomVariablesRequestProcessor.php(76),#4/core/Tracker/Visit.php(174),#5/core/Tracker.php(155),#6/core/Tracker/Handler.php(57),#7/core/Tracker.php(135),#8/core/Tracker.php(112),#9/piwik.php(76)

The affected code seems to be

/core/Tracker/Request.php(635)

            if ($id < 1
                || $id > $maxCustomVars
                || count($keyValue) != 2

URL decoded url part for tracking request

&_cvar={"1":"[\"ENV\", \"DEV\"]"}&

ENV

OS debian 10.6
SETUP: NGINX + PHP-FPM
PHP 7.3.19-1~deb10u1 (fpm-fcgi) (built: Jul  5 2020 06:46:45)
Matomo version 3.14.1
Tracking via Javascript Client

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugFor errors / faults / flaws / inconsistencies etc.wontfixIf you can reproduce this issue, please reopen the issue or create a new one describing it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions