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

Fix error when adding new goals if no previous goals exist for website/measurable #19124

Closed
Starker3 opened this issue Apr 20, 2022 · 6 comments · Fixed by #19136
Closed

Fix error when adding new goals if no previous goals exist for website/measurable #19124

Starker3 opened this issue Apr 20, 2022 · 6 comments · Fixed by #19136
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@Starker3
Copy link
Contributor

When adding a Goal to a website or measurable that does not already have a goal results in the following warning and error:

WARNING Goals[2022-04-20 21:55:47 UTC] [9e913] /home/matomo4/plugins/Goals/Controller.php(145): Warning - foreach() argument must be of type array|object, null given - Matomo 4.9.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) #0/plugins/Goals/Controller.php(145),#1/plugins/Goals/Controller.php(127),[internal function]: Piwik\Plugins\Goals\Controller->addNewGoal(),#3/core/FrontController.php(631),#4/core/FrontController.php(169),#5/core/dispatch.php(32),#6/index.php(25)
ERROR Piwik\FrontController[2022-04-20 21:55:47 UTC] [9e913] Uncaught exception: /home/matomo4/plugins/Goals/templates/_addEditGoal.twig(20): Variable "ecommerceEnabled" does not exist. [Query: ?date=today&module=Goals&format=html&action=addNewGoal&idGoal=&idSite=29&period=day&segment=&widget=&showtitle=1&random=8971, CLI mode: 0]

The actual error doesn't seem to have anything to do with Ecommerce being enabled as enabling it doesn't resolve the error. The error does not appear on other sites where goals already exist.

This is the result of a backtrace:

WARNING Goals[2022-04-20 22:05:13 UTC] [545cf] /home/matomo4/plugins/Goals/Controller.php(145): Warning - foreach() argument must be of type array|object, null given - Matomo 4.9.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) #0/plugins/Goals/Controller.php(145),#1/plugins/Goals/Controller.php(127),[internal function]: Piwik\Plugins\Goals\Controller->addNewGoal(),#3/core/FrontController.php(631),#4/core/FrontController.php(169),#5/core/dispatch.php(32),#6/index.php(25)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] Uncaught exception: /home/matomo4/plugins/Goals/templates/_addEditGoal.twig(20): Variable "ecommerceEnabled" does not exist.
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #0 /home/matomo4/tmp/innocraft-staff-richard.alwaysdata.net/templates_c/ea/ea158b7cb562e7ece908b29255ddececaf3713b09a4023dcb962fa32c5f1b965.php(83): __TwigTemplate_007ee7500e73a72cbcff0e0f82a44c2b1e87ac9e0877e4e966b1e6c6d8970fb7->{closure}()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #1 /home/matomo4/vendor/twig/twig/src/Template.php(394): __TwigTemplate_007ee7500e73a72cbcff0e0f82a44c2b1e87ac9e0877e4e966b1e6c6d8970fb7->doDisplay(Array, Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #2 /home/matomo4/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #3 /home/matomo4/tmp/innocraft-staff-richard.alwaysdata.net/templates_c/ca/ca290d028ac2a2efca679136b225995fb27791d94a6554e8e5d03c93b06ffb33.php(55): Twig\Template->display(Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #4 /home/matomo4/vendor/twig/twig/src/Template.php(394): __TwigTemplate_066414c30ac46c4843ac62dcbfeb3891730824aab858689698b85b8656fb6bc6->doDisplay(Array, Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #5 /home/matomo4/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #6 /home/matomo4/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #7 /home/matomo4/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render(Array, Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #8 /home/matomo4/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render(Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #9 /home/matomo4/core/View.php(331): Twig\Environment->render('@Goals/addNewGo...', Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #10 /home/matomo4/core/View.php(316): Piwik\View->renderTwigTemplate()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #11 /home/matomo4/plugins/Goals/Controller.php(128): Piwik\View->render()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #12 [internal function]: Piwik\Plugins\Goals\Controller->addNewGoal()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #13 /home/matomo4/core/FrontController.php(631): call_user_func_array(Array, Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #14 /home/matomo4/core/FrontController.php(169): Piwik\FrontController->doDispatch('Goals', 'addNewGoal', Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #15 /home/matomo4/core/dispatch.php(32): Piwik\FrontController->dispatch()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #16 /home/matomo4/index.php(25): require_once('/home/innocraft...')
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] #17 {main} [Query: ?date=today&module=Goals&format=html&action=addNewGoal&idGoal=&idSite=29&period=day&segment=&widget=&showtitle=1&random=9922, CLI mode: 0]

  • Matomo Version: 4.9.0
@Starker3 Starker3 added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Apr 20, 2022
@Starker3 Starker3 changed the title Unable to add new goals if no previous goals exist for Website/Measurable in 4.9.0 Uncaught error when adding new goals if no previous goals exist for Website/Measurable in 4.9.0 Apr 20, 2022
@Starker3
Copy link
Contributor Author

This was also reported on the forum: https://forum.matomo.org/t/plugin-goals-error-after-update-4-9-0/45519/9
There is a workaround to create Goals by going to Settings > Websites > Goals and adding a goal there.

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/plugin-goals-error-after-update-4-9-0/45519/19

@MichaelRoosz
Copy link
Contributor

I have added a pull request with a fix.

@sgiehl sgiehl added this to the 4.10.0 milestone Apr 25, 2022
@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Apr 25, 2022
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/error-in-4-9-1-after-upgrade-from-4-9-0/45726/2

@justinvelluppillai justinvelluppillai changed the title Uncaught error when adding new goals if no previous goals exist for Website/Measurable in 4.9.0 Fix error when adding new goals if no previous goals exist for website/measurable May 9, 2022
@carlgrundberg
Copy link

When is 4.10.0 going to be released? This issue should be fixed asap.

@justinvelluppillai
Copy link
Contributor

Early next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants