Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
When running the "ThemeKey" cron, it shows following watchdog notice:
Notice: Undefined index: in themekey_cron_clear_page_cache() (line 34 of themekey/themekey_cron.inc).
Comment | File | Size | Author |
---|---|---|---|
#10 | tinny-themekey-ui.png | 14.37 KB | tinny |
#10 | tinny-themekey-dsm.png | 88.09 KB | tinny |
#9 | ThemeKey.jpg | 34.26 KB | pachabhaiya |
#5 | themekey-fix_undefined_index_notice_in_themekey_cron_clear_page_cache-2373335-5.patch | 1.03 KB | pachabhaiya |
Comments
Comment #1
mkalkbrennerWhich version of ThemeKey are you using? Please post the content of line 38 here.
In current dev I don't see how an "Undefined index" error could be triggered:
Comment #2
pachabhaiya CreditAttribution: pachabhaiya commentedIn themekey/themekey_cron.inc file (line 34), the value of `$item->property` is sometimes empty. And when this `$item->property` is empty then it throws the watchdog notice as mentioned in this issue.
Attached patch to fix this issue.
Comment #3
pachabhaiya CreditAttribution: pachabhaiya commentedComment #4
pachabhaiya CreditAttribution: pachabhaiya commentedHi mkalkbrenner,
Sorry, it's line 34 instead of 38. I've corrected the issue title.
Comment #5
pachabhaiya CreditAttribution: pachabhaiya commentedAttached patch to fix this issue.
Comment #6
mkalkbrennerYour patch is not correct. It simply hides an error.
The function themekey_rebuild() creates this array. And it should not happen, that $item->property doesn't exist as array key.
Unfortunately I was not able tor reproduce this issue. Therfor some debugging on your side will be required to find the real issue. Can you do a var_dump($item) when $item->property doesn't exist?
Comment #7
pachabhaiya CreditAttribution: pachabhaiya commentedWhen I run this SQL then I get the following result:
SELECT tp.* FROM themekey_properties tp WHERE enabled = 1
When I execute
dd($item)
inside the foreach statement, I get the following result in the drupal_debug.txtThe bottom one without the "property" value (id = 5) is throwing the watchdog error.
"sub_acquia_marina" is the subtheme of 'acquia_marina". I will do some more debug backtrace to find the issue.
Comment #8
mkalkbrennerThe database entry for id 5 is corrupt. Can you access it in the ThemeKey administration interface?
I guess the property should be "drupal:path".
Comment #9
pachabhaiya CreditAttribution: pachabhaiya commented@mkalkbrenner
Yes, I can access the ThemeKey administration page.
Attached a screenshot of what I see for id = 5.
Comment #10
tinny CreditAttribution: tinny commentedIm getting the same error.
When a
drupal:path:wildcard
is added theproperty
becomes the wildcard identifier. This is not a valid attribute in:$attributes = variable_get('themekey_attributes', array());
Comment #11
jacob.embree CreditAttribution: jacob.embree at 3Sages commentedThe
drupal:path:wildcard
behaves that way for me as well, so the assumption that$attributes[$item->property]['page cache']
exists is not a valid one, nor is it an error when it doesn't exist, so the check should be performed.