Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning - Array to string conversion in Pdo.php(229) from DataAccess/Model.php #21410

Open
tsteur opened this issue Oct 17, 2023 · 14 comments
Open
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@tsteur
Copy link
Member

tsteur commented Oct 17, 2023

Saw below warning in Matomo 5 in our logs. Unsure if this is new to Matomo 5 or has happened before in Matomo 4.

Looking at core/DataAccess/Model.php(914) maybe there's an issue when eg $idSite is an array or so?

Unfortunately, I don't have more information

WARNING CoreAdminHome[2023-10-02 21:21:08 UTC] [d2480 /libs/Zend/Db/Statement/Pdo.php(229): Warning - Array to string conversion - Matomo 5.0.0-rc4 - 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/libs/Zend/Db/Statement/Pdo.php(229),#2/libs/Zend/Db/Statement.php(300),#3/libs/Zend/Db/Adapter/Abstract.php(479),#4/libs/Zend/Db/Adapter/Pdo/Abstract.php(238),#5/core/Db/Adapter/Pdo/Mysql.php(325),#6/libs/Zend/Db/Adapter/Abstract.php(827),#7/core/Db.php(344),#8/core/DataAccess/Model.php(914),#9/core/ArchiveProcessor/Loader.php(530)

@tsteur tsteur added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Oct 17, 2023
@bx80
Copy link
Contributor

bx80 commented Oct 18, 2023

I tried to recreate this by creating invalidations with multiple sites, but they were correctly parsed into multiple invalidations. As a workaround we could add a check to ensure that parameters are of the correct type and log the parameters for further debugging if not.

@bx80 bx80 added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Oct 18, 2023
@bx80 bx80 added this to the For Prioritization milestone Oct 18, 2023
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/error-when-creating-a-new-segment/54274/2

@KimCarolyn2023
Copy link

Hi @bx80 does this bug affect the functionality of the segment? Can the data still be trusted? Thanks in advance.

@bx80
Copy link
Contributor

bx80 commented Dec 6, 2023

Hi @KimCarolyn2023, it looks like the code that throws the error is checking whether an archive invalidation exists, so it seems unlikely that it would cause the segment data to be inaccurate, but it could potentially prevent a segment being updated - unfortunately it's hard to tell without more investigation.

If you have any additional information on recreating this issue then that could be useful 👍

@lneuville
Copy link

Hi, I'm having the same issue as @KimCarolyn2023 when creating a simple segment on a Matomo Cloud site (Acquisition Channel = search).

WARNING: /libs/Zend/Db/Statement/Pdo.php(229): Warning - Array to string conversion - Matomo 5.0.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) (Module: API, Action: get, Method: API.get, In CLI mode: false)

Don't know what to do here

Thanks for any idea

Good'day

@bx80
Copy link
Contributor

bx80 commented Feb 1, 2024

Thanks for the extra details @lneuville. From what I can see from where the error occurs, as long as the segment was created and has data then you shouldn't need to do anything.

We'll need to schedule time to investigate this issue in more depth and work out what particular circumstances cause the error.

@sgiehl
Copy link
Member

sgiehl commented Feb 2, 2024

I had a quick look. I don't think that's caused by the idSites. It's more likely caused by the reports parameter.
The problem might have its origin here:

matomo/core/Archive.php

Lines 910 to 924 in adcae6d

// process for each plugin as well
foreach ($archiveNamesByPlugin as $plugin => $archiveNames) {
$doneFlag = $this->getDoneStringForPlugin($plugin, $idSites);
$this->initializeArchiveIdCache($doneFlag);
$reportsToArchiveForThisPlugin = (empty($requestedReport) && $shouldOnlyProcessRequestedArchives) ? $archiveNames : $requestedReport;
$prepareResult = $coreAdminHomeApi->archiveReports(
$site->getId(),
$period->getLabel(),
$periodDateStr,
$this->params->getSegment()->getOriginalString(),
$plugin,
$reportsToArchiveForThisPlugin
);

The report parameter might be set to $archiveNames, which can be an array. This will be set to the archive parameters as archiveOnlyReport. And the archive loader might then pass it to hasInvalidationForPeriodAndName here:

return !$this->dataAccessModel->hasInvalidationForPeriodAndName($params->getSite()->getId(), $params->getPeriod(), $doneFlag, $params->getArchiveOnlyReport());

But hasInvalidationForPeriodAndName uses this parameter as string only.

Haven't tested in which constellation this might happen, but might help when trying to reproduce.

@9joshua
Copy link
Contributor

9joshua commented Mar 4, 2024

Another Cloud customer reported this:
WARNING: /libs/Zend/Db/Statement/Pdo.php(229): Warning - Array to string conversion - Matomo 5.0.2
Error received when modifying a segment.

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/warning-libs-zend-db-statement-pdo-php-229/55710/2

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/warning-libs-zend-db-statement-pdo-php-229-warning-array-to-string-conversion-matomo-5-0-0-rc9/54747/3

@9joshua
Copy link
Contributor

9joshua commented Apr 8, 2024

Another Cloud customer reported this:
WARNING: /libs/Zend/Db/Statement/Pdo.php(229): Warning - Array to string conversion
Error received when creating a new segment with a simple filter (Channel Type = search).

@9joshua
Copy link
Contributor

9joshua commented Apr 9, 2024

Another Cloud customer is seeing this error quite regularly, especially when using longer time periods and/or segments.
image

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/warning-array-to-string-conversion-matomo-5-2-0/60881/2

@paul-buttimore
Copy link

Another Cloud customer reported this today:
WARNING: /libs/Zend/Db/Statement/Pdo.php(229): Warning - Array to string conversion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

8 participants