Closed (fixed)
Project:
EU Cookie Compliance (GDPR Compliance)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Jun 2019 at 16:46 UTC
Updated:
3 Aug 2019 at 11:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
liam morlandComment #3
krina.addweb commented@Liam Morland, Your patch is working fine & removes the error that shown after clearing the caches. I checked it with the reference of simplytest.me and local & attached the screenshots for the same.
Comment #4
svenryen commentedThanks Liam, and Krina for the RTBC. I'll commit later.
Comment #5
svenryen commentedI reviewed the attached patch. In my opinion this issue still needs work.
Let's say you already have a value for "cookie_categories" in the database. What the updated code does is it will first load the popup banner settings from the database, then it adds (and in my opinion overwrites the value coming from the database with) a new value, being NULL.
(Note I haven't run the resulting code after applying your patch, but my impression is that this will happen. Feel free to correct me if I'm wrong).
If we first initialize the default
$popup_settingsarray and then afterwards add the values from the database, we will not have this problem.Do you agree, Liam? Here's an updated patch. Can somebody review?
Comment #6
travis-bradbury commented+ $popup_settings += variable_get('eu_cookie_compliance', array());That should be
variable_get(...) + $popup_settingsto set defaults. The values in that variable will not overwrite what's in $popup_settings.Does this fix the problem generally or just for a few settings? My site has 40 values in the eu_cookie_compliance variable but this only guarantees 7 exist.
Comment #7
svenryen commentedI should think so. Most settings have a default fallback when used. But if you say so, it wouldn't hurt to specify all defaults in this function.
Comment #8
liam morland#6 is correct: The defaults have to be added to the configured values; they will not overwrite existing values, only set a value where one does not exist. The patch in #2 does it this way.
It is easy to add additional values to the defaults.
I don't think this needs a D8 port since eu_cookie_compliance_get_settings() doesn't exist in the D8 version.
Comment #9
liam morlandRe-submitting the patch in #2 for review.
Comment #10
svenryen commented