I get the following error when trying to display any of the calendar views:

Fatal error: Cannot use object of type date_api_argument_handler as array in ..\sites\all\modules\calendar\calendar.views.inc on line 504

I'm using the last dev version of the views module from CVS, the most recent (Beta2) version of the date module and the Dev version of the calendar module

Comments

cps@groups.drupal.org’s picture

I have the same Error:
Date 6.x-2.x-dev (2008-Jun-11)
Calendar 6.x-2.0-beta2
Views 6.x-2.x-dev (2008-Jun-11)

but in line 500

mrfelton’s picture

same issue for me (different line number). Using latest CVS for date, calendar, cck and views:

Fatal error: Cannot use object of type date_api_argument_handler as array in /home/tom/www/playhouse-6.2/sites/all/modules/calendar/calendar.views.inc on line 500

imagetag’s picture

Same here. Lastest build from views, newest betas of calendar and date.

loze’s picture

Yup. me too

gvdvenis’s picture

I did an attempt to sort this out, and i did manage to get rid of all the errors and white screens, but i probably broke some other stuff alongside with the "fix". Anyway beneath is the code i started changing to get started. After that, i got confronted with a lot of other problems. The only problem is that i do not know if this is a result of the issue at hand here, or if it's a result of my changes to this code.

    // starts at line 499 of the beta2 version of calendar.views.inc
    foreach ($this->view->argument as $delta => $argument) {
      if ($argument->options['id'] == 'date_argument') {
        $this->view->granularity = !empty($argument->date_handler->granularity) ? $argument->date_handler->granularity : $argument->options['granularity'];
        $this->view->date_arg = !empty($this->view->args) ? $this->view->args[$argument->position] : '';
        $this->view->date_arg_pos = $i;
        $this->view->year = isset($argument->year) ? $argument->year : NULL;
        $this->view->month = isset($argument->month) ? $argument->month: NULL;
        $this->view->day = isset($argument->day) ? $argument->day : NULL;
        $this->view->week = isset($argument->week) ? $argument->week : NULL;
        $this->view->min_date = $argument->min_date;
        $this->view->max_date = $argument->max_date;
      }
      $i++;
    }

As you can see in this code, the $argument variable structure has changed from an array to an object somehow and some attributes have probably been moved to a separate "options" array.

Anyhow, the whole thing seems related to changes in the Views module. Hope this helped someone getting this issue fixed. If anyone has interest in a patch of all the changes i made to get rid of all errors (whether they are correct or not) please let me know and ill post a patch here.

KarenS’s picture

I'm not getting this error, so I'm having trouble figuring out why others are.

imagetag’s picture

Could it be, that the views dev changed since your last commit? The Dev on that FTP is packaged after your last release? Just guessing.

I read, that this error only affects PHP5, cos the script tries to handle an object, like it was an array. Since PHP 5.2 (imo), that's forbidden. I printed out the $argument and found some different object recursion, this of course, could be a problem, too.

KarenS’s picture

OK, just updated Views to the very latest -dev version and now I'm getting this error, too, so something changed in Views between the version I was using and the latest. I'll have to investigate.

KarenS’s picture

Found the change -- http://drupal.org/cvs?commit=120575 -- it specifically says it could impact Date and Calendar. Now I need to figure out what changes are needed :)

KarenS’s picture

Status: Active » Fixed

I think I found all the fixes need for the Calendar module to adapt to that change in Views. I still need to look through the Date module to see what else might be affected there.

gvdvenis’s picture

where can we get the updates? are you planning on releasing an updated development version anytime soon?

Anonymous’s picture

Status: Fixed » Closed (fixed)

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