@Starker3 opened this Issue on December 14th 2021 Contributor

Refs L3-194
We have a user with 4 different Matomo servers, only one of them has this issue.

They are able to get the reports downloaded or sent when using just a "Day" period, but any other period such as week or month results in the above error.

So for example the following scheduled reports fail:

/index.php?module=API&action=index&idSite=10&period=week&date=2021-11-10&limit=100&updated=7&method=ScheduledReports.generateReport&idReport=3&outputType=3&language=en

/index.php?module=API&action=index&idSite=10&period=month&date=2021-11-18&limit=100&updated=8&method=ScheduledReports.generateReport&idReport=3&outputType=3&language=en

And the following one does work:

/index.php?module=API&action=index&idSite=10&period=day&date=2021-12-03&limit=100&updated=9&method=ScheduledReports.generateReport&idReport=3&outputType=3&language=en

Full error output:


ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/18'>#18</a> {main}
-- | -- | -- | -- | --
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/17'>#17</a> /var/www/html/matomo/index.php(25): require_once('...')
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/16'>#16</a> /var/www/html/matomo/core/dispatch.php(32): Piwik\FrontController->dispatch()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/15'>#15</a> /var/www/html/matomo/core/FrontController.php(168): Piwik\FrontController->doDispatch()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/14'>#14</a> /var/www/html/matomo/core/FrontController.php(619): call_user_func_array()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/13'>#13</a> [internal function]: Piwik\Plugins\API\Controller->index()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/12'>#12</a> /var/www/html/matomo/plugins/API/Controller.php(46): Piwik\API\Request->process()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/11'>#11</a> /var/www/html/matomo/core/API/Request.php(266): Piwik\API\Proxy->call()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/10'>#10</a> /var/www/html/matomo/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/9'>#9</a> /var/www/html/matomo/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/8'>#8</a> /var/www/html/matomo/core/API/Proxy.php(244): call_user_func_array()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/7'>#7</a> [internal function]: Piwik\Plugins\ScheduledReports\API->generateReport()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/6'>#6</a> /var/www/html/matomo/plugins/ScheduledReports/API.php(540): array_walk()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/5'>#5</a> [internal function]: Piwik\ReportRenderer\Pdf->renderReport()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/4'>#4</a> /var/www/html/matomo/core/ReportRenderer/Pdf.php(333): Piwik\ReportRenderer\Pdf->paintReportTable()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/3'>#3</a> /var/www/html/matomo/core/ReportRenderer/Pdf.php(380): TCPDF->Cell()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/2'>#2</a> /var/www/html/matomo/vendor/tecnickcom/tcpdf/tcpdf.php(5114): TCPDF->getCellCode()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/1'>#1</a> /var/www/html/matomo/vendor/tecnickcom/tcpdf/tcpdf.php(5308): TCPDF_FONTS::UTF8StringToArray()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | <a href='/0'>#0</a> /var/www/html/matomo/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2004): array_map()
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | Stack trace:
ERROR | Piwik\FrontController | 2021-12-10 11:14:04 UTC | e9fa0 | Uncaught  exception: TypeError: array_map(): Argument <a href='/2'>#2</a> ($array) must be of type  array, bool given in  /var/www/html/matomo/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php:2004

Your Environment

  • Matomo Version: 4.5.0
  • PHP Version: 8.0.13
  • Server Operating System: Oracle Linux 8 UEK Release 6 (Kernel 5.4.17)
@sgiehl commented on December 14th 2021 Member

@Starker3 Do you know if the data that would be included in the report might contain some special unicode characters, like emojis or similar?

@Starker3 commented on December 14th 2021 Contributor

I'll check with the user @sgiehl

@vonloxley commented on January 10th 2022

We have the same error when generating PDF-Reports, and only then:

ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] Uncaught exception: TypeError: array_map(): Argument <a href='/2'>#2</a> ($array) must be of type array, bool given in /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php:2004
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] Stack trace:
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/0'>#0</a> /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2004): array_map(Array, false)
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/1'>#1</a> /var/www/html/vendor/tecnickcom/tcpdf/tcpdf.php(5308): TCPDF_FONTS::UTF8StringToArray('Handlungsleitfa...', true, Array)
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/2'>#2</a> /var/www/html/vendor/tecnickcom/tcpdf/tcpdf.php(5114): TCPDF->getCellCode(100, 6, 'Handlungsleitfa...', 'LR', 0, 'L', true, false, 0, true, 'T', 'M')
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/3'>#3</a> /var/www/html/core/ReportRenderer/Pdf.php(380): TCPDF->Cell(100, 6, 'Handlungsleitfa...', 'LR', 0, 'L', true, false)
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/4'>#4</a> /var/www/html/core/ReportRenderer/Pdf.php(333): Piwik\ReportRenderer\Pdf->paintReportTable()
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/5'>#5</a> [internal function]: Piwik\ReportRenderer\Pdf->renderReport(Array, 20)
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/6'>#6</a> /var/www/html/plugins/ScheduledReports/API.php(540): array_walk(Array, Array)
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/7'>#7</a> [internal function]: Piwik\Plugins\ScheduledReports\API->generateReport('5', 'today', 'de', '3', 'day', 'pdf', false)
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/8'>#8</a> /var/www/html/core/API/Proxy.php(244): call_user_func_array(Array, Array)
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC] [93925] <a href='/9'>#9</a> /var/www/html/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
ERROR Piwik\FrontController[2022-01-10 07:05:28 UTC]

We are using the official docker-image (Apache) version 4.6.2. It is quite likely that unicode charachters are involved. The string in question is most likely Handlungsleitfaden_Umgang mit Corona-Verdachtsfällen.

If you need any more information, please do not hesitate to ask.

@vonloxley commented on January 10th 2022
@tsteur commented on January 10th 2022 Member

We have the same issue in production. Below stack trace:

I see there is a UTF8StringToArray('MyTest dispon...',. I find 3 related action names in the log_action table, they contain below characters, not sure if this causes an issue?

  • Test-Matomo
  •  - Test - 
  • Test d&<a href='/039'>#039</a>;aMatomo -

ERROR [2022-01-10 22:07:36] 15766 Uncaught exception: TypeError: array_map(): Argument #2 ($array) must be of type array, bool given in vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php:2004
Stack trace:
#0 vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2004): array_map(Array, false)
#1 vendor/tecnickcom/tcpdf/tcpdf.php(5308): TCPDF_FONTS::UTF8StringToArray('MyTest dispon...', true, Array)
#2 vendor/tecnickcom/tcpdf/tcpdf.php(5114): TCPDF->getCellCode(100, 6, 'Services dispon...', 'LR', 0, 'L', true, false, 0, true, 'T', 'M')
#3 core/ReportRenderer/Pdf.php(380): TCPDF->Cell(100, 6, 'Services dispon...', 'LR', 0, 'L', true, false)
#4 core/ReportRenderer/Pdf.php(333): Piwik\ReportRenderer\Pdf->paintReportTable()
#5 [internal function]: Piwik\ReportRenderer\Pdf->renderReport(Array, 5)
#6 plugins/ScheduledReports/API.php(540): array_walk(Array, Array)
#7 plugins/ScheduledReports/API.php(608): Piwik\Plugins\ScheduledReports\API->generateReport('5', '2022-01-03', 'fr', 2, 'week')
#8 core/Context.php(75): Piwik\Plugins\ScheduledReports\API->Piwik\Plugins\ScheduledReports{closure}()
#9 plugins/ScheduledReports/API.php(679): Piwik\Context::changeIdSite('5', Object(Closure))
#10 [internal function]: Piwik\Plugins\ScheduledReports\API->sendReport('5')
#11 core/Scheduler/Scheduler.php(276): call_user_func(Array, '5')
#12 core/Scheduler/Scheduler.php(148): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Scheduler\Task))
#13 plugins/CoreAdminHome/API.php(69): Piwik\Scheduler\Scheduler->run()
#14 core/CronArchive.php(627): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#15 core/CronArchive.php(264): Piwik\CronArchive->runScheduledTasks()
#16 core/Access.php(661): Piwik\CronArchive->Piwik{closure}()
#17 core/CronArchive.php(269): Piwik\Access::doAsSuperUser(Object(Closure))
#18 plugins/CoreConsole/Commands/CoreArchiver.php(32): Piwik\CronArchive->main()
#19 vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 core/Console.php(130): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 core/Access.php(670): Piwik\Console->Piwik{closure}()
#25 core/Console.php(131): Piwik\Access::doAsSuperUser(Object(Closure))
#26 core/Console.php(82): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 console(32): Symfony\Component\Console\Application->run()
#29 {main}

@Starker3 commented on January 10th 2022 Contributor

FYI - Never got confirmation from the end-user if they had special unicode characters (Eg. Emoji, etc)

@peterhashair commented on January 12th 2022 Contributor

@tsteur just confirm the version number for TCPDF and PHP, they fix some issue, I think our issue is related to TCPDF_STATIC::pregSplit https://github.com/tecnickcom/TCPDF/blob/42cd0f9786af7e5db4fcedaa66f717b0d0032320/CHANGELOG.TXT#L20-L22

@tsteur commented on January 13th 2022 Member

We're using the latest Matomo 4.6.2 and PHP 8. Not sure what version of TCPDF was included in 4.6.2 @peterhashair

@sgiehl commented on January 18th 2022 Member

@peterhashair @tsteur As mentioned above, this is most likely related to https://github.com/tecnickcom/TCPDF/issues/464
Unless that gets fixed in TCPDF, I'm not sure if there is much we can do about that.

@tsteur commented on January 18th 2022 Member

@sgiehl can we fork this repository and apply the fix or so? We have emails failing every day about this for few accounts meaning it's quite a big issue that scheduled reports aren't working

@sgiehl commented on January 18th 2022 Member

There is not yet a fix for that. But I can try to reproduce that locally tomorrow and see if I'm able to provide one. I guess simply suppressing the error might result in some missing text in the PDF. Also I wonder how that error actually occurs. It might mean that regex doesn't support unicode on that system maybe, or that the string contains a character that isn't valid unicode...

@sgiehl commented on January 20th 2022 Member

Turns our this was actually unrelated to TCPDF. Will propose a fix for that soon.

This Issue was closed on January 26th 2022
Powered by GitHub Issue Mirror