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

tcpdf - Warning - array_merge(): Expected parameter 1 to be an array, null given - Matomo 4.1.1 #17182

Open
datango opened this issue Feb 3, 2021 · 17 comments
Labels
Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data

Comments

@datango
Copy link

datango commented Feb 3, 2021

matomo/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010)
Warning - array_merge(): Expected parameter 1 to be an array, null given - Matomo 4.1.1

(when running ./console core:archive)

@diosmosis
Copy link
Member

diosmosis commented Feb 4, 2021

@datango Are you using any scheduled reports? Can you try clicking the 'Send report now' link for each on the 'Email Reports' admin page to find which one is causing this error?

Can you also provide the core:archive output?

And can you let us know if you're using matomo from git or are installing composer dependencies yourself?

@diosmosis diosmosis added the Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data label Feb 4, 2021
@davidlemaitre
Copy link

davidlemaitre commented Mar 1, 2021

Facing with this issue on Matomo 3.14.1 for sending scheduled reports. The first ones are OK, for the next 6 ones, this error occurs :
WARNING [2021-03-01 00:08:13] 28013 /var/www/html/libs/Zend/Mail/Protocol/Abstract.php(324): Notice - fwrite(): send of 6 bytes failed with errno=32 Broken pipe - 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).

And for the final reports, these errors occur :
INFO [2021-03-01 00:08:52] 28013 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_65... WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2002): Warning - array_map(): Expected parameter 2 to be an array, bool given - 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) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010): Warning - array_merge(): Expected parameter 2 to be an array, null given - 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) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(1800): 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) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/tcpdf.php(5268): 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) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2002): Warning - array_map(): Expected parameter 2 to be an array, bool given - 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) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010): Warning - array_merge(): Expected parameter 1 to be an array, null given - 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) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/tcpdf.php(4085): Warning - Invalid argument supplied for foreach() - 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).

Using official matomo Docker image. When I click on "Send report now", the problematic reports are sent without errors.

@diosmosis
Copy link
Member

Hi @davidlemaitre, thanks for the info! For the reports that failed, would you be able to provide the report configuration found in the "Email Reports" admin page? Is there anything different about the ones that failed compared to the ones that succeeded? (Note: if you do not wish to post that information publicly, you can email me: dizzy@innocraft.com)

@Findus23
Copy link
Member

Findus23 commented Mar 1, 2021

WARNING [2021-03-01 00:08:13] 28013 /var/www/html/libs/Zend/Mail/Protocol/Abstract.php(324): Notice - fwrite(): send of 6 bytes failed with errno=32 Broken pipe - 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).

In Matomo 4 the old Mail library has been replaced with a modern one, so this error might be fixed there

@crazy-max
Copy link

@Findus23 Same on Matomo 4.2.1:

WARNING [2021-03-02 06:59:13] 992  /var/www/matomo/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010): Warning - array_merge(): Expected parameter 1 to be an array, null given - Matomo 4.2.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)

@sgiehl
Copy link
Member

sgiehl commented Mar 2, 2021

@crazy-max I'm not sure how that actually happens for you, but I assume this might be a bug in TCPDF. It actually calls an array_merge on parameters, when one might not be an array, on purpose.
As TCPDF is kind of unmaintained at the moment we need to see how to fix that.

@davidlemaitre
Copy link

Hi @diosmosis, we have a lot of users configuring scheduled reports keeping the default hour. At different hours, all reports are sent successfully but there are only 2 reports maximum to send.

I checked matomo_report db table, I found nothing different between the succeeded reports and the failed ones except for "ts_last_sent" field containing an old date but this is also the case for the last 2 succeeded reports at hour 0.

A CSV export of the first failed report with the warning fwrite(): send of 6 bytes failed with errno=32 :

"57";"51";"*****";"Rapport mensuel*****";NULL;"month";"0";"email";"pdf";"[""VisitsSummary_get"",""Actions_get"",""Actions_getPageUrls"",""Referrers_get""]";"{""displayFormat"":""1"",""emailMe"":false,""evolutionGraph"":false,""additionalEmails"":[""i*@*.fr"",""p*@*.com""]}";"2020-08-06 07:16:21";"2021-01-01 00:06:12";"0";"0";"30";"month"

And a CSV export of the final report causing the ton of warnings (the last one is also about fwrite(): send of 6 bytes failed with errno=32):

"65";"25";"*****";"*** mensuel";NULL;"month";"0";"email";"pdf";"[""VisitsSummary_get"",""DevicesDetection_getType"",""Resolution_getResolution"",""Actions_get"",""Actions_getPageUrls"",""Actions_getEntryPageUrls"",""Actions_getExitPageUrls"",""Actions_getPageTitles"",""Actions_getSiteSearchKeywords"",""Actions_getPageUrlsFollowingSiteSearch"",""Actions_getSiteSearchNoResultKeywords"",""Actions_getDownloads"",""VisitorInterest_getNumberOfVisitsPerVisitDuration"",""VisitorInterest_getNumberOfVisitsPerPage"",""Referrers_get"",""Referrers_getKeywords""]";"{""displayFormat"":""1"",""emailMe"":true,""evolutionGraph"":false}";"2021-02-22 08:23:58";"2021-02-22 08:53:39";"0";"0";"1";"month"

@sgiehl
Copy link
Member

sgiehl commented Mar 2, 2021

@davidlemaitre Does the fwrite(): send of 6 bytes failed with errno=32 error only occur when the report is sent, or also when you click the download button for the report in the UI?
That error message for example might occur when the mail server closes the connection due to incorrect TLS version or similar.

@davidlemaitre
Copy link

@sgiehl these errors occur only for some scheduled reports. If I click on "Send report now" or "Download" buttons, nothing to notice in the logs.

@sgiehl
Copy link
Member

sgiehl commented Mar 3, 2021

@davidlemaitre which PHP version are you using? Also are you using a cron for archiving? Maybe the log level is different for webserver and cli and so you can see the errors only when triggered through cli and not UI maybe?

@davidlemaitre
Copy link

@sgiehl Using official Matomo Docker image version 3.14.1 (PHP 7.4 embedded). A cron is used for archiving every hour.
Found also this fwrite(): send of 6 bytes failed with errno=32 error for notifyTrackingFailures task :

INFO [2021-03-08 00:09:45] 24948 Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.notifyTrackingFailures... WARNING [2021-03-08 00:09:45] 24948 /var/www/html/libs/Zend/Mail/Protocol/Abstract.php(324): Notice - fwrite(): send of 6 bytes failed with errno=32 Broken pipe - 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)

@sgiehl
Copy link
Member

sgiehl commented Mar 8, 2021

@davidlemaitre could you try if running the command works for you and if the email is sent our correctly:

./console core:test-email your@email

@davidlemaitre
Copy link

Test email received without errors. My problem is about some reports sent at default hour (majority of users don't change the value in the settings of the report), it seems there errors appear only when there is a lot of reports to send.

@sgiehl
Copy link
Member

sgiehl commented Mar 8, 2021

Might it be possible that your mail server cuts the connection when too many emails are sent?

@pdavide
Copy link

pdavide commented Dec 1, 2021

@davidlemaitre I'm currently facing the same issue with Matomo 3.14.1. How did you fixed it?

Thanks.

@davidlemaitre
Copy link

Hi @pdavide, I changed the send hour for problematic reports to a quiet hour, no error occurs.

@pdavide
Copy link

pdavide commented Dec 1, 2021

Hi @pdavide, I changed the send hour for problematic reports to a quiet hour, no error occurs.

Thanks @davidlemaitre.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data
Projects
None yet
Development

No branches or pull requests

8 participants