@Starker3 opened this Issue on April 20th 2022 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) <a href='/0'>#0</a>/plugins/Goals/Controller.php(145),<a href='/1'>#1</a>/plugins/Goals/Controller.php(127),[internal function]: Piwik\Plugins\Goals\Controller->addNewGoal(),<a href='/3'>#3</a>/core/FrontController.php(631),<a href='/4'>#4</a>/core/FrontController.php(169),<a href='/5'>#5</a>/core/dispatch.php(32),<a href='/6'>#6</a>/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) <a href='/0'>#0</a>/plugins/Goals/Controller.php(145),<a href='/1'>#1</a>/plugins/Goals/Controller.php(127),[internal function]: Piwik\Plugins\Goals\Controller->addNewGoal(),<a href='/3'>#3</a>/core/FrontController.php(631),<a href='/4'>#4</a>/core/FrontController.php(169),<a href='/5'>#5</a>/core/dispatch.php(32),<a href='/6'>#6</a>/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] <a href='/0'>#0</a> /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] <a href='/1'>#1</a> /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] <a href='/2'>#2</a> /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] <a href='/3'>#3</a> /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] <a href='/4'>#4</a> /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] <a href='/5'>#5</a> /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] <a href='/6'>#6</a> /home/matomo4/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/7'>#7</a> /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] <a href='/8'>#8</a> /home/matomo4/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render(Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/9'>#9</a> /home/matomo4/core/View.php(331): Twig\Environment->render('<a class='mention' href='https://github.com/Goals'>@Goals</a>/addNewGo...', Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/10'>#10</a> /home/matomo4/core/View.php(316): Piwik\View->renderTwigTemplate()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/11'>#11</a> /home/matomo4/plugins/Goals/Controller.php(128): Piwik\View->render()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/12'>#12</a> [internal function]: Piwik\Plugins\Goals\Controller->addNewGoal()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/13'>#13</a> /home/matomo4/core/FrontController.php(631): call_user_func_array(Array, Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/14'>#14</a> /home/matomo4/core/FrontController.php(169): Piwik\FrontController->doDispatch('Goals', 'addNewGoal', Array)
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/15'>#15</a> /home/matomo4/core/dispatch.php(32): Piwik\FrontController->dispatch()
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/16'>#16</a> /home/matomo4/index.php(25): require_once('/home/innocraft...')
ERROR Piwik\FrontController[2022-04-20 22:05:13 UTC] [545cf] <a href='/17'>#17</a> {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 commented on April 21st 2022 Contributor

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 commented on April 21st 2022

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 commented on April 22nd 2022 Contributor

I have added a pull request with a fix.

@MatomoForumNotifications commented on April 28th 2022

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

@carlgrundberg commented on May 13th 2022

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

@justinvelluppillai commented on May 13th 2022 Contributor

Early next week.

This Issue was closed on April 25th 2022
Powered by GitHub Issue Mirror