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

Uncaught exception: TypeError: key(): Argument #1 ($array) must be of type array, null given in /var/www/html/plugins/ImageGraph/API.php:242 #18609

Closed
tsteur opened this issue Jan 12, 2022 · 5 comments · Fixed by #18687
Assignees
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Jan 12, 2022

PHP 8.0

Uncaught exception: TypeError: key(): Argument #1 ($array) must be of type array, null given in /plugins/ImageGraph/API.php:242
Stack trace:
#0 /plugins/ImageGraph/API.php(242): key(NULL)
#1 [internal function]: Piwik\Plugins\ImageGraph\API->get(1, 'day', '2021-12-12,2022...', 'SearchEngineKey...', 'getCrawlingErro...', 'evolution', '2', false, false, true, 700, 200, 9, 11, true, false, false, '222222', 'FFFFFF', 'CCCCCC', false, true, false, false)
#2 /core/API/Proxy.php(244): call_user_func_array(Array, Array)
#3 /core/Context.php(28): Piwik\API\Proxy->Piwik\API{closure}()
#4 /core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#5 /core/API/Request.php(266): Piwik\API\Proxy->call('\Piwik\Plugins\...', 'get', Array)
#6 /core/ReportRenderer.php(270): Piwik\API\Request->process()
#7 /core/ReportRenderer/Html.php(176): Piwik\ReportRenderer::getStaticGraph(Array, 700, 200, false, NULL)
#8 /core/ReportRenderer/Html.php(140): Piwik\ReportRenderer\Html->getAttachment(Array, Array, 'Monday, January...')
#9 /plugins/ScheduledReports/API.php(1021): Piwik\ReportRenderer\Html->getAttachments(Array, Array, 'Monday, January...')
#10 /plugins/ScheduledReports/API.php(551): Piwik\Plugins\ScheduledReports\API->getAttachments(Object(Piwik\ReportRenderer\Html), Array, Array, 'Monday, January...')
#11 /plugins/ScheduledReports/API.php(608): Piwik\Plugins\ScheduledReports\API->generateReport('1', '2022-01-10', 'en', 2, 'day')
#12 /core/Context.php(75): Piwik\Plugins\ScheduledReports\API->Piwik\Plugins\ScheduledReports{closure}()
#13 /plugins/ScheduledReports/API.php(679): Piwik\Context::changeIdSite('1', Object(Closure))
#14 [internal function]: Piwik\Plugins\ScheduledReports\API->sendReport('1')
#15 /core/Scheduler/Scheduler.php(276): call_user_func(Array, '1')
#16 /core/Scheduler/Scheduler.php(148): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Scheduler\Task))
#17 /plugins/CoreAdminHome/API.php(69): Piwik\Scheduler\Scheduler->run()
#18 /core/CronArchive.php(627): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#19 /core/CronArchive.php(264): Piwik\CronArchive->runScheduledTasks()
#20 /core/Access.php(661): Piwik\CronArchive->Piwik{closure}()
#21 /core/CronArchive.php(269): Piwik\Access::doAsSuperUser(Object(Closure))
#22 /plugins/CoreConsole/Commands/CoreArchiver.php(32): Piwik\CronArchive->main()
#23 /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))
#24 /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))
#25 /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))
#26 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /core/Console.php(130): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /core/Access.php(670): Piwik\Console->Piwik{closure}()
#29 /core/Console.php(131): Piwik\Access::doAsSuperUser(Object(Closure))
#30 /core/Console.php(82): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /console(32): Symfony\Component\Console\Application->run()
#33 {main}

@tsteur tsteur added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Jan 12, 2022
@tsteur tsteur added this to the 4.7.0 milestone Jan 12, 2022
@tsteur tsteur added the Regression Indicates a feature used to work in a certain way but it no longer does even though it should. label Jan 12, 2022
@tsteur
Copy link
Member Author

tsteur commented Jan 12, 2022

Marking this as a regression as it used to work on older PHP versions and now prevents us from sending scheduled reports.

@peterhashair
Copy link
Contributor

No luck to reproduce this one, but would that works
/plugins/ImageGraph/API.php(242)

        -    if (empty($columns)
        +   if (empty($columns) && !$metadata['metrics']) 

@sgiehl
Copy link
Member

sgiehl commented Jan 12, 2022

@tsteur this might be an issue with the SearchPerformance plugin. The report GetCrawlingErrorExamplesBing does not define any metrics, as it's no typical report. It can't be displayed as an evolution. So we either could try to prevent that report to be included in scheduled reports at all, or we display an empty graph in that case (which was the case with PHP 7 I guess).

@tsteur
Copy link
Member Author

tsteur commented Jan 12, 2022

@sgiehl I'll create an issue for the feature to change this. Does it make sense to at least still keep showing an empty report so things at least won't fail? Or we keep failing so it's more clear if unexpected things happen?
I don't have a clear preference as both have pros and cons. I suppose if core would render an empty graph in that case and not fail, we might still notice there's an issue?

@sgiehl
Copy link
Member

sgiehl commented Jan 13, 2022

I guess we will only notice an error if someone reports it if the graphs are empty.
Maybe we could check if a metric to print is available and if not, log an error and maybe even print an error in the PDF instead. Just a simple text that an error occurred while processing this report.

@justinvelluppillai justinvelluppillai modified the milestones: 4.7.0, 4.8.0 Jan 18, 2022
@peterhashair peterhashair self-assigned this Jan 25, 2022
@justinvelluppillai justinvelluppillai added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants