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).

Comments

mkalkbrenner’s picture

Which 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:

if ($match && !$processed) {}
pachabhaiya’s picture

In 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.

pachabhaiya’s picture

Title: Notice: Undefined index: in themekey_cron_clear_page_cache() (line 38 of themekey/themekey_cron.inc). » Notice: Undefined index: in themekey_cron_clear_page_cache() (line 34 of themekey/themekey_cron.inc).
Issue summary: View changes
pachabhaiya’s picture

Hi mkalkbrenner,

Sorry, it's line 34 instead of 38. I've corrected the issue title.

pachabhaiya’s picture

Attached patch to fix this issue.

mkalkbrenner’s picture

Status: Active » Postponed (maintainer needs more info)

Your 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?

pachabhaiya’s picture

Status: Postponed (maintainer needs more info) » Active

When I run this SQL then I get the following result:

SELECT tp.* FROM themekey_properties tp WHERE enabled = 1

id	property	operator	value	weight	theme	enabled	wildcards	parent
6	drupal:path	=	some-news	-50	sub_acquia_marina	1	a:0:{}	0 
5	                =	some-news/%	-49	sub_acquia_marina	1	a:0:{}	0

When I execute dd($item) inside the foreach statement, I get the following result in the drupal_debug.txt

stdClass Object
(
    [id] => 6
    [property] => drupal:path
    [operator] => =
    [value] => some-news
    [weight] => -50
    [theme] => sub_acquia_marina
    [enabled] => 1
    [wildcards] => a:0:{}
    [parent] => 0
)

stdClass Object
(
    [id] => 5
    [property] => 
    [operator] => =
    [value] => sub-news/%
    [weight] => -49
    [theme] => sub_acquia_marina
    [enabled] => 1
    [wildcards] => a:0:{}
    [parent] => 0
)

The 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.

mkalkbrenner’s picture

Category: Bug report » Support request

The database entry for id 5 is corrupt. Can you access it in the ThemeKey administration interface?
I guess the property should be "drupal:path".

pachabhaiya’s picture

StatusFileSize
new34.26 KB

@mkalkbrenner
Yes, I can access the ThemeKey administration page.
Attached a screenshot of what I see for id = 5.

theme key

tinny’s picture

StatusFileSize
new88.09 KB
new14.37 KB

Im getting the same error.

When a drupal:path:wildcard is added the property becomes the wildcard identifier. This is not a valid attribute in:

$attributes = variable_get('themekey_attributes', array());

jacob.embree’s picture

Status: Active » Reviewed & tested by the community

The 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.