matomo icon indicating copy to clipboard operation
matomo copied to clipboard

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

Open tsteur opened this issue 1 year ago • 13 comments

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 avatar Oct 17 '23 22:10 tsteur

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 avatar Oct 18 '23 23:10 bx80

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

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

KimCarolyn2023 avatar Dec 05 '23 14:12 KimCarolyn2023

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 :+1:

bx80 avatar Dec 06 '23 03:12 bx80

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

lneuville avatar Feb 01 '24 09:02 lneuville

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.

bx80 avatar Feb 01 '24 20:02 bx80

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: https://github.com/matomo-org/matomo/blob/adcae6d34f7fd5cfb23036924193692261386baa/core/Archive.php#L910-L924

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: https://github.com/matomo-org/matomo/blob/8878b7a5872bfb52a22124f529fcd7de7270f370/core/ArchiveProcessor/Loader.php#L530

But hasInvalidationForPeriodAndName uses this parameter as string only.

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

sgiehl avatar Feb 02 '24 10:02 sgiehl

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.

9joshua avatar Mar 04 '24 19:03 9joshua

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

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

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 avatar Apr 08 '24 21:04 9joshua

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

9joshua avatar Apr 09 '24 21:04 9joshua