Plugin Goals error after Update 4.9.0

Hi,

the following error occurs after update to 4.9.0 if there are already no goals defined and want to create a new goal.

WARNING: /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) (Module: Goals, Action: addNewGoal, In CLI mode: false)

I have the same issue。

Related to:

:question:

I have the same issue too :frowning:

seeing the same here.

  • self hosted
  • php 8.17
  • Matomo 4.9
  • nginx/1.18.0
  • memory limit 256MB

let me know how else we can assist in troubleshooting.

im re editing this post with more info.

if i use the action “add a goal” from the “Become A Matomo Expert” menu.

see image.

then we can add a goal.

it also pops up with this error when creating using the above workflow.

The string General_Description was not loaded in javascript. Make sure it is added in the Translate.getClientSideTranslationKeys hook.

hope the above helps fix this bug.

""Cheers
G

@velocity08 , your issue seems not the same as the one of Francesco, paprika or Maul75…
in your case, have a look at:

Hi @heurteph-ei

actually it is the exact same error with the same warnings precisely.

i just didn’t upload the same errors as they where already presented and simply referenced the same error as the original poster Maul75 and the next poster paprika.

i had no goals defined and the error that popped up is identical in both cases.

the difference is that i found a work around to create a goal which is why i edited my post after finding it and provided the info for others.

even after creating a goal there are other elements broken on page.

see attached image.

hope this helps.

""Cheers
G

since im limited to posting 1 image per post ive had to add another reply with the other image.

""Cheers
G

OK.
Maybe you encounter several different problems…
Can you try the Stefan Giehl solution, just for the test of translations?

Then for the other error:

  • When did it happen the first time? After a PHP update? After Matomo update (from/to which versions)?
  • What kind of errors do you see in the JavaScript console and in the Network log of the developer tool of your browser?

after replying to your message i took your advise and enabled tag manager (which i didn’t know existed)

and the errors ive pointed out in the screen shots went away.

WTF?

some how these items are linked i have no idea how or why but they are now all working after enabling tag manager.

thank you for the tip greatly appreciated :slight_smile:

""Cheers
G

All errors disappeared?

yep 100% as advised :slight_smile:

there is some intrinsic link here that shouldn’t exist but it does - lol.

there may be some code in the general section that’s cross referencing code in the tag manager, when its disabled there is a block and the errors we have all been referencing.

once TM is enabled the code is accessible and working.

that’s me trying to logically pull it apart.

is tag manager a new 4.9 feature?

""Cheers
G

No it is an old feature, but the UI framework changed recently from AngularJS to Vue…

yep cool.

this should fix it for the other users.

thanks again for pointing me to this fix.

""Cheers
G

After upgrading my on-premise install to 4.9.0, I’m also see the same thing as in parprika’s screen shot above. Using Chrome Developer Tools, I was able to see this additional information:

The following error just broke Matomo (v4.9.0):

Variable “ecommerceEnabled” does not exist.
in /var/www/analytics.empactcareers.org/docroot/plugins/Goals/templates/_addEditGoal.twig line 20

I have the same issue here (on premise) as both @Maul75 (code) & @paprika (screenshot) when attempting to access the “Add a new Goal” from the Dashboard.

However, if I go to ‘Settings >> Websites >> Goals’, i can setup a new goal from there.

@AgentEccks @Paul_McKibben did you try to enable the Tag Manager?

@heurteph-ei Yes, I have tag manager enabled.

Issue created in backlog:

@Philippe: Yes, same error with TagManager Activated.