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

[Bug] Fatal error: Call to a member function getSqlSegment() on null in Segment.php #21573

Closed
4 tasks done
tsteur opened this issue Nov 20, 2023 · 1 comment · Fixed by #21574
Closed
4 tasks done

[Bug] Fatal error: Call to a member function getSqlSegment() on null in Segment.php #21573

tsteur opened this issue Nov 20, 2023 · 1 comment · Fixed by #21574
Assignees
Labels
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 Nov 20, 2023

What happened?

This seems to be a Matomo 5 regression.

This fatal error happened on 5.0.0-rc8

Error: {"message":"Call to a member function getSqlSegment() on null","file":"/core/Segment.php","line":407,"request_id":"c983d","backtrace":" on /core/Segment.php(407)\n#0 /core/Segment.php(269): Piwik\Segment->getCleanedExpression(Array)\n#1 /core/Segment.php(151): Piwik\Segment->initializeSegment('dimension3==mon...', Array)\n#2 /plugins/SegmentEditor/API.php(421): Piwik\Segment->__construct('dimension3==mon...', Array)\n#3 /plugins/SegmentEditor/API.php(398): Piwik\Plugins\SegmentEditor\API->filterSegmentsWithDisabledElements(Array, false)\n#4 [internal function]: Piwik\Plugins\SegmentEditor\API->getAll(false)\n#5 /core/API/Proxy.php(255): call_user_func_array(Array, Array)\n#6 /core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()\n#7 /core/API/Proxy.php(346): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))\n#8 /core/API/Request.php(272): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getAll', Array)\n#9 /core/API/Request.php(583): Piwik\API\Request->process()\n#10 /plugins/SegmentEditor/SegmentEditor.php(390): Piwik\API\Request::processRequest('SegmentEditor.g...', Array, Array)\n#11 /core/Segment.php(681): Piwik\Plugins\SegmentEditor\SegmentEditor::getAllSegmentsForSite(false)\n#12 /plugins/API/Filter/DataComparisonFilter.php(393): Piwik\Segment->getStoredSegmentName(false)\n#13 /plugins/API/Filter/DataComparisonFilter.php(218): Piwik\Plugins\API\Filter\DataComparisonFilter->getMetadataFromModifiedParams(Array)\n#14 /core/API/DataTablePostProcessor.php(519): Piwik\Plugins\API\Filter\DataComparisonFilter->compare(Object(Piwik\DataTable))\n#15 /core/API/DataTablePostProcessor.php(124): Piwik\API\DataTablePostProcessor->applyComparison(Object(Piwik\DataTable))\n#16 /core/Plugin/Visualization.php(561): Piwik\API\DataTablePostProcessor->process(Object(Piwik\DataTable))\n#17 /core/Plugin/Visualization.php(194): Piwik\Plugin\Visualization->applyFilters()\n#18 /core/Plugin/Report.php(344): Piwik\Plugin\Visualization->render()\n#19 /plugins/CoreHome/Controller.php(59): Piwik\Plugin\Report->render()\n#20 [internal function]: Piwik\Plugins\CoreHome\Controller->renderReportWidget(Object(Piwik\Plugins\Referrers\Reports\GetReferrerType))\n#21 /core/FrontController.php(637): call_user_func_array(Array, Array)\n#22 /core/FrontController.php(169): Piwik\FrontController->doDispatch('Referrers', 'getReferrerType', Array)\n#23 /core/dispatch.php(32): Piwik\FrontController->dispatch()\n#24 /index.php(25): require_once('/c...')\n#25 {main}","safemode_backtrace":"#0 [internal function]: Piwik\Plugins\Cloud\Controller->safemode(Array)\n#1 /core/FrontController.php(637): call_user_func_array(Array, Array)\n#2 /core/FrontController.php(169): Piwik\FrontController->doDispatch('Cloud', 'safemode', Array)\n#3 /core/FrontController.php(100): Piwik\FrontController->dispatch('CorePluginsAdmi...', 'safemode', Array)\n#4 /core/FrontController.php(140): Piwik\FrontController::(Array)\n#5 /core/FrontController.php(196): Piwik\FrontController::(Object(Error))\n#6 /core/dispatch.php(32): Piwik\FrontController->dispatch()\n#7 /index.php(25): require_once('/c...')\n#8 {main}"}

URL: /index.php?segment=revenueOrder%3C0.01&date=2023-08-01,2023-11-19&module=Referrers&format=html&forceView=1&viewDataTable=tableGoals&action=getReferrerType&documentationForGoalsPage=1&idGoal=0&idSite=11&period=range&comparePeriods%5B%5D=range&compareDates%5B%5D=2023-04-13%2C2023-07-31&widget=&showtitle=1&random=6750

Referrer: /index.php?module=CoreHome&action=index&idSite=11&period=day&date=yesterday&updated=1

Similar issue happens for some when sending scheduled reports:

[2023-11-20 02:32:05] piwik.DEBUG: Task Piwik\Plugins\ScheduledReports\API.sendReport_1 is scheduled to run again for 2023-11-27. {"task":"Piwik\Plugins\ScheduledReports\API.sendReport_1","date":"[object] (Piwik\Date: 2023-11-27)"} {"class":"CoreAdminHome","request_id":"26468"}
[2023-11-20 02:32:05] piwik.INFO: Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_1... {"taskName":"Piwik\Plugins\ScheduledReports\API.sendReport_1"} {"class":"CoreAdminHome","request_id":"26468"}
[2023-11-20 02:32:05] piwik.ERROR: Scheduler: Error Call to a member function getSqlSegment() on null for task 'Piwik\Plugins\ScheduledReports\API.sendReport_1' {"errorMessage":"Call to a member function getSqlSegment() on null","task":"Piwik\Plugins\ScheduledReports\API.sendReport_1"} {"class":"CoreAdminHome","request_id":"26468"}

What should happen?

No error

How can this be reproduced?

Unsure.
Maybe the stack trace helps?

Matomo major version

Matomo 5

Matomo minor or patch Version

0

PHP version

.

Server operating system

.

What browsers are you seeing the problem on?

No response

Computer operating system

.

Relevant log output

No response

Validations

@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 Nov 20, 2023
@sgiehl sgiehl added Regression Indicates a feature used to work in a certain way but it no longer does even though it should. 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 Nov 20, 2023
@sgiehl sgiehl added this to the 5.0.0 milestone Nov 20, 2023
@sgiehl
Copy link
Member

sgiehl commented Nov 20, 2023

I was able to reproduce that one. It seems to be a regression from #21521 in combination with using the comparison feature, but might be possible it also occurs in other scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants