Hi!

After updating to the 7.x-1.35 version I get the following errors at /admin/config/system/eu-cookie-compliance

Notice: Undefined index: popup_position in eu_cookie_compliance_admin_form() (regel 642 van /var/www/customprojects/teakpoint/dev/docroot/sites/all/modules/contrib/eu_cookie_compliance/eu_cookie_compliance.admin.inc).
Notice: Undefined index: popup_position in eu_cookie_compliance_admin_form() (regel 642 van /var/www/customprojects/teakpoint/dev/docroot/sites/all/modules/contrib/eu_cookie_compliance/eu_cookie_compliance.admin.inc).
Notice: Undefined index: popup_position in eu_cookie_compliance_admin_form() (regel 642 van /var/www/customprojects/teakpoint/dev/docroot/sites/all/modules/contrib/eu_cookie_compliance/eu_cookie_compliance.admin.inc).

After filling in all the fields and clicking save I return to the same page but the fields I filled in are fully blank again.

Any help would be appreciated.

-

I upgraded from version 7.x-1.34, the problem already occured in 1.33. Everything went good in version 1.32.

Output from drush vget eu_cookie_compliance:

eu_cookie_compliance: { }
eu_cookie_compliance_categories: { }
eu_cookie_compliance_cookie_lifetime: '100'
eu_cookie_compliance_domain: ''

Comments

Samle created an issue. See original summary.

svenryen’s picture

Hi!

Which version did you upgrade from?

Can you run drush vget eu_cookie_compliance and share the output here?

Samle’s picture

Hello Sven

I did upgrade from 7.x-1.34 but there also my GDPR banner wasn't showing up, I had no problems with version 7.x-1.32.

The output of drush vget eu_cookie_compliance:

eu_cookie_compliance: { }
eu_cookie_compliance_categories: { }
eu_cookie_compliance_cookie_lifetime: '100'
eu_cookie_compliance_domain: ''

svenryen’s picture

Thanks. Which version of Drush are you using? Is it possible for you to expand the eu_cookie_compliance variable?
I get a full output from Drush 8.

Samle’s picture

I checked my Drush version and right now it's 7.4.0.
How can I expand the eu_cookie_compliance variable?

svenryen’s picture

Are you saying that the banner doesn't show up at all, even in an Incognito window?

Any chance you can dig into your database and run this instead:
select value from variable where name = 'eu_cookie_compliance';

Have you tried saving the configuration?
Do you use multiple languages or the domain module?

neslee canil pinto’s picture

@Samle I did a test on my local machine with the instructions specified above and I am not able to reproduce your error.

svenryen’s picture

Is the site live somewhere? Can you set up a staging site for us to test?

svenryen’s picture

Just checking, you did run drush updb?

anybody’s picture

Status: Active » Postponed (maintainer needs more info)
svenryen’s picture

Thanks for changing the state, @Anybody.

@Samle, if you provide additional details, we can reopen the issue. I have seen the same situation myself and resolved it by reinstalling the module, so there definitely can be an issue there under some cases. So please provide any information you think is useful for us.

cbeier’s picture

Status: Postponed (maintainer needs more info) » Active

I have the same problem (or the same error message) with a page after the update. After some tests I could observe the following:

Initial situation:
Update eu_cookie_compliance from 1.32 to 1.35.
The site is a multisite installation (different databases) and one site is multilingual (i18n_variable).

After updating the module and run the updates (drush updb or update.php) the settings array is empty (variable_get('eu_cookie_compliance') is empty).

Also, the revert of the Feature (with the exported settings from eu_cookie_compliance module -> Strongarm) has no effect. The module settings of the EU Cookie Compliance Module remain empty.

After resetting the DB (to the state before the update) I executed the update functions one by one:

  • eu_cookie_compliance_update_7014() - ok
  • eu_cookie_compliance_update_7015() - ok
  • eu_cookie_compliance_update_7016() - ok
  • eu_cookie_compliance_update_7017() - wrong, empty settings array
  • eu_cookie_compliance_update_7018() - also empty (of course)

I think the problem occurs only in connection with multilingual websites (i18n_variable module enabled).
I compared the past update functions with the eu_cookie_compliance_update_7017 function:

  • In previous update functions the updated settings were saved with: variable_realm_set('language', $langcode, 'eu_cookie_compliance', $updated_setting, FALSE)
  • In the 7017 function with: i18n_variable_set('eu_cookie_compliance_categories', $categories, $langcode)

After I changed the save function in function eu_cookie_compliance_update_7017() from i18n_variable_set() to variable_realm_set(), there was no problem after executing all update functions.

I hope the information will be helpful.

svenryen’s picture

Status: Active » Needs review
StatusFileSize
new2.66 KB

Thanks @cbeier, for debugging this issue. That was really helpful. I've been able to come up with a patch.

Can any of you take this patch for a spin and see if it resolves your issue? You'd have to roll back to 1.32 (or set up a test site) and run drush updb again.

Test steps:
1. Set up a site with 2 or more languages
2. Install version 1.32 of EU Cookie Compliance
3. Save configuration for each language
4. Update to 1.35 and apply this patch

You should now see your stored config when you visit the setting page for this module, rather than the default config and the error message.

Samle’s picture

StatusFileSize
new47.19 KB

Hello Sven,

I just updated to the 7.x-1.36 version. I still get the following error on my website and it's still not working.
I can't save any data nor enable the banner while in the admin page.

See the attachment for more info.

cbeier’s picture

Status: Needs review » Needs work

Unfortunately the patch does not work. The described behaviour still occurs, that the module settings are empty after running the updates.

I will try to analyze this more in detail.

cbeier’s picture

Status: Needs work » Needs review
StatusFileSize
new2.59 KB

I have changed the patch from #13.

The problem was that i18n_variable_get loaded the settings for all languages and saved them later. Even if the result for one language was empty.

In my installation the module settings for the default language (of the drupal installation) is saved via variable_set(). For this (default) language, the result of i18n_variable_get() is empty. If this empty result is now saved as a realm variable, the module settings (for the default language) then always come from i18n_variable_get() and no longer from variable_get().

francoud’s picture

I noticed the same problem in one multilingual website, but was too late to restore a previous database. Anyway, I am now able to run version 1.36 without a patch. What I did:

- disable and uninstall the module (note that simply reinstalling again didn't solve the problem)
- in the database, using phpmyadmin, I manually deleted every occurrence of "eu_cookie" in every table. This included >200 entries in the "Locale" table, and an entry in the "system" table, where the eu_cookie module was still listed
- upgraded the module (was: 1.33, updated to: 1.36) on the filesystem
- install the module from zero in the website.
And of course I had to create again all the configuration (banner content, etc.).

Well, empirical but it solved my problem without patching the module.

Note that in a multilingual enviroment, you should also configure the "eu cookie compliance" variable to have different cookie profiles for different languages. http://your.website/admin/config/regional/i18n/variable (other).

In that website, I didn't selected that variable, and I had the problem. In another multilingual website, where the variable was selected in that configuration, the module, 1.36, worked without any problem.

Hope this will help...?

alesbencina’s picture

Like francout mentioned

you have to go to the /nl/admin/config/regional/i18n/variable and check EU Cookie Compliance so the settings are set for every language.

quotientix’s picture

Thanks alesbencina, #18 helped!

mile23’s picture

StatusFileSize
new699 bytes

Interdiff from #13 to #16.

This issue looks to be similar to #3189115: Updating from 7.x-1.32 to 1.35 destroyed my config, because that issue only applies to multilingual sites as well. Other sites work fine.

  • svenryen committed a3055fc on 7.x-1.x
    Issue #3179618 by svenryen, cbeier, Samle, Mile23, rubaff, alesbencina,...
svenryen’s picture

Status: Needs review » Fixed

  • svenryen committed a3055fc on 7.x-2.x
    Issue #3179618 by svenryen, cbeier, Samle, Mile23, rubaff, alesbencina,...
  • svenryen committed df4e221 on 7.x-2.x
    Merge branch '7.x-1.x' into 7.x-2.x
    
    * 7.x-1.x:
      Issue #3206637 by...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

arx-e’s picture

I had 7.x-1.36 installed and now the latest dev (7.x-1.36+21-dev (2021-May-25)) but as soon as I visit the config page (admin/config/system/eu-cookie-compliance) I get the triplet of notices and the page isn't saving settings. I tried uninstalling, cleanup and reinstallation as described in #17 but that didn't have any effect.
I think I had set up the module long time ago with some previous version and it used to work fine.

Notice: Undefined index: popup_position in eu_cookie_compliance_admin_form() (line 642 of /home/ecoschoo/public_html/sites/all/modules/eu_cookie_compliance/eu_cookie_compliance.admin.inc).
    Notice: Undefined index: popup_position in eu_cookie_compliance_admin_form() (line 642 of /home/ecoschoo/public_html/sites/all/modules/eu_cookie_compliance/eu_cookie_compliance.admin.inc).
    Notice: Undefined index: popup_position in eu_cookie_compliance_admin_form() (line 642 of /home/ecoschoo/public_html/sites/all/modules/eu_cookie_compliance/eu_cookie_compliance.admin.inc).
arx-e’s picture

I don't know whether it is correct but my solution was to catch that undefined setting in an if statement. So now I can save the settings and I haven't done extensive testing but it seems to work.
This is what I replaced line 642 with:

  if (!empty($popup_settings['popup_position'])) {
    $popup_position_value = ($popup_settings['popup_position'] === TRUE ? 'top' : ($popup_settings['popup_position'] === FALSE ? 'bottom' : $popup_settings['popup_position']));
    }
    else {
    $popup_position_value = 'bottom';
    }
svenryen’s picture

Status: Closed (fixed) » Active

Thanks for the report, @arx-e , I'll take a look.

Does your site have multiple languages, or do you use the Domain module?

arx-e’s picture

Yes, the site where I saw this problem has English and Greek activated and Greek as the default language. I tried setting English as the default but it didn't solve the issue,
Basically when visiting the admin page there was nothing selected on the Position section (neither Top nor Bottom),
Still I have at least a couple other Drupal 7 sites with the same language setup where this error is not occurring.
And I am not using the Domain module anywhere.

svenryen’s picture

arx-e, would you mind doing a drush vget eu_cookie_compliance and either paste the result here or send it to me through the contact form (click my user name to find my contact form on drupal.org)? I'd like to see what's the actual value for $popup_settings['popup_position']

arx-e’s picture

Of course! Here is what I just got:

eu_cookie_compliance:
  popup_enabled: 1
  method: opt_in
  info_template: new
  enable_save_preferences_button: 1
  save_preferences_button_label: 'Save preferences'
  accept_all_categories_button_label: 'Accept all cookies'
  disabled_javascripts: ''
  automatic_cookies_removal: 1
  allowed_cookies: ''
  consent_storage_method: do_not_store
  popup_clicking_confirmation: false
  popup_info:
    value: 'Ο ιστότοπός μας χρησιμοποιεί cookies για την ομαλή λειτουργία του.'
    format: full_html
  use_mobile_message: 0
  mobile_popup_info:
    value: ''
    format: full_html
  mobile_breakpoint: '768'
  popup_agree_button_message: Αποδέχομαι
  show_disagree_button: true
  popup_disagree_button_message: 'Περισσότερες Πληροφορίες'
  disagree_button_label: 'Δεν συμφωνώ'
  withdraw_enabled: 0
  withdraw_button_on_info_popup: 0
  withdraw_message:
    value: ''
    format: full_html
  withdraw_tab_button_label: ''
  withdraw_action_button_label: ''
  popup_agreed_enabled: 0
  popup_hide_agreed: 0
  popup_agreed:
    value: ''
    format: full_html
  popup_find_more_button_message: 'More info'
  popup_hide_button_message: Απόκρυψη
  popup_link: node/3379
  popup_link_translate: 0
  popup_link_new_window: 1
  cookie_policy_version: 1.0.0
  containing_element: body
  popup_position: false
  use_bare_css: 0
  popup_text_hex: ffffff
  popup_bg_hex: 0779bf
  popup_height: ''
  popup_width: 100%
  fixed_top_position: 0
  popup_delay: '1000'
  disagree_do_not_show_popup: 0
  reload_page: 0
  popup_scrolling_confirmation: false
  cookie_name: ''
  cookie_value_disagreed: '0'
  cookie_value_agreed_show_thank_you: '1'
  cookie_value_agreed: '2'
  domains_option: '1'
  domains_list: ''
  exclude_paths: ''
  exclude_admin_pages: 0
  exclude_uid_1: 0
  script_scope: footer
  better_support_for_screen_readers: 0
  cookie_session: 0
eu_cookie_compliance_categories: {  }
eu_cookie_compliance_cookie_lifetime: '100'
eu_cookie_compliance_domain: ''
eu_cookie_compliance_domain_all_sites: 0
arx-e’s picture

But I am not sure this is useful because right after outputing the variables I went back and reverted the eu_cookie_compliance.admin.inc file line 642 to its original form and I can't see the error. The "Bottom" option is now selected and I can save the settings page.
I will try to find the previous state of the site to see if I can get the variables as they were when the error occurred.

arx-e’s picture

Ok I got access to the site as it was before 15 July. The module had been installed some time more than a year ago (I can not remember when) but at some point had stopped working (hadn't noticed -_-).

So with 7.x-1.36 installed I got the following from drush vget eu_cookie_compliance :

eu_cookie_compliance: {  }
eu_cookie_compliance_categories: {  }
eu_cookie_compliance_cookie_lifetime: '100'
eu_cookie_compliance_domain: ''
eu_cookie_compliance_domain_all_sites: 0

After deactivating, uninstalling and reinstalling the module I got

eu_cookie_compliance_categories: {  }
eu_cookie_compliance: {  }

And in both cases I get the error on line 642 and I am unable to save the settings page.

youlikeit’s picture

I have the same error message although after applying patches, deinstall the module and installing the dev version.

svenryen’s picture

@youlikeit and @arx-e, have you installed the dev-version or 1.36?

arx-e’s picture

@svenryen I just tested updating 7.x-1.36 to 7.x-1.36+22-dev (2021-July-30) (also run the update 7019) and the problem continues the same.
I repeated the above test on a local copy of the site I have kept from 14 July.
On the live site I have solved the issue by applying the solution I described in #26. After visiting the page once with that code the value for top/bottom gets saved and I don;t see any other problem.

svenryen’s picture

I went ahead and committed the suggested change from #26. For the record, here's the code as a patch.

  • svenryen committed efe94cd on 7.x-1.x
    Issue #3179618 by svenryen, cbeier, Samle, Mile23, arx-e, francoud,...
svenryen’s picture

Status: Active » Fixed
neslee canil pinto’s picture

Version: 7.x-1.35 » 7.x-1.x-dev

  • svenryen committed baf741b on 7.x-2.x
    Merge branch '7.x-1.x' into 7.x-2.x
    
    * 7.x-1.x:
      Issue #3236586 by...
  • svenryen committed efe94cd on 7.x-2.x
    Issue #3179618 by svenryen, cbeier, Samle, Mile23, arx-e, francoud,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.