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

Notice: Undefined variable: create_only_fields in googleanalytics_preprocess_layout() #27

Closed
bugfolder opened this issue Jul 6, 2022 · 4 comments · May be fixed by #28
Closed

Notice: Undefined variable: create_only_fields in googleanalytics_preprocess_layout() #27

bugfolder opened this issue Jul 6, 2022 · 4 comments · May be fixed by #28

Comments

@bugfolder
Copy link

Seeing this error in watchdog:

Notice: Undefined variable: create_only_fields in googleanalytics_preprocess_layout() 
(line 284 of .../modules/contrib/googleanalytics/googleanalytics.module).

The problem seems to be that line 284 is this:

    $create_only_fields = array_merge($create_only_fields, $codesnippet_create);

This is the first usage of $create_only_fields in the function, so of course it is an undefined variable. Changing that line to

    $create_only_fields = $codesnippet_create;

fixes the problem.

@laryn
Copy link
Member

laryn commented Jul 7, 2022

Works for me.

@stpaultim
Copy link
Member

stpaultim commented Jul 8, 2022

Came to report the same problem. We are ALSO getting this error in addition to the error reported above:

Warning: array_merge(): Expected parameter 1 to be an array, null given in googleanalytics_preprocess_layout() 
(line 284 of /src/modules/contrib/googleanalytics/googleanalytics.module).

Same line number so hopefully the same solution fixes both. We will test PR and report back here.

@rajpaul
Copy link

rajpaul commented Jul 8, 2022

@stpaultim The PR by @bugfolder fixed both of the notice/warning.

@stpaultim
Copy link
Member

@rajpaul - Thanks for the confirming this. Hope to see this in a new release.

jenlampton pushed a commit to jenlampton/googleanalytics that referenced this issue Jul 11, 2022
jenlampton pushed a commit to jenlampton/googleanalytics that referenced this issue Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants