I'm getting the following warning on a 4.7.6 install with the latest dev (13 March 07) of date and also latest version of pathauto. Whenever I try to change the pathauto settings. It also comes up when using the pageroute module.

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /var/www/modules/contrib/date/date_pathauto.inc on line 22.

The same error is found on other lines, as well.

Comments

techczech’s picture

I just discovered that his happens also on node submit.

techczech’s picture

OK, I got around this temporarily by commenting out the include of date_pathauto.inc (line 27) in date.module. Which shouldn't matter because I don't use date elements anywhere in my paths -- I think.

karens’s picture

I am not familiar enough with pathauto to fix this, so I need a patch from someone who is.

robomalo’s picture

This also happens in Drupal 5.

techczech’s picture

I can confirm this happening in both 5.1 and 4.7.6. with the latest releases of Date and Pathauto.

karens’s picture

Status: Active » Fixed

I committed something that should make the error go away. It is saying that granularity is not an array, which it should be, but it may be choking on new fields where that hasn't yet been added to the info returned by content_fields(). I'm not completely sure this is the right fix but it should keep any error from appearing. If more work is needed, you can reopen.

robomalo’s picture

Did the fix make it to head and not 5.x-1.4? I tried downloading 5.x-1.4 again and it still has the same bug. Thanks.

robomalo’s picture

Status: Fixed » Active

In regards to my previous post, it looks like the change you made in head on line 21 also needs to be made on line 70:
if ($field['type'] == 'date' || $field['type'] == 'datestamp') {
should become
if (($field['type'] == 'date' || $field['type'] == 'datestamp') && is_array($field['granularity'])) {

webchick’s picture

StatusFileSize
new4.04 KB

Nice sleuthing! Here's a patch!

I also had to wrap stuff around line 90 in an "if is_array($field['granularity'])"

I'm not sure if this is the right fix, though. But at least I don't have nasty errors anymore. :)

webchick’s picture

Status: Active » Needs review
StatusFileSize
new4.04 KB

Nice sleuthing! Here's a patch!

I also had to wrap stuff around line 90 in an "if is_array($field['granularity'])"

I'm not sure if this is the right fix, though. But at least I don't have nasty errors anymore. :)

karens’s picture

Status: Needs review » Fixed

Fixed. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)