While attempting to display dates in a view composed of nodes created from a custom content type, I received the following error for each of the displayed nodes...

warning: array_pop() [function.array-pop]: The argument should be an array in /nfs/c05/h04/mnt/77219/domains/mydomain.com/html/es/sites/all/modules/date/date_api.module on line 760.

Examining line 760 revealed that is was performing an array_pop on $granularity. When I asked Drupal to report the contents of $granularity, it indicated it was blank. This was quite puzzling as the wrapping function (date_make_date) provides a default array setting for $granularity (array('year', 'month', 'day', 'hour', 'minute')).

As I was unable to trace the reason for the missing array for $granularity and since the dates were displaying properly anyway, I inserted the following just prior to line 760...

if(!is_array($granularity)) {$granularity = array('year', 'month', 'day', 'hour', 'minute'); }

... which cured the problem.

I hope I'm not duplicating an already known issue. I did look through the list of issues and did not see this one there.

Cheers
Roland Combes

Comments

Macronomicus’s picture

getting the same issue for some reason, your fix seems to have stopped the error for now.

qbnflaco’s picture

I seem to be getting a similar issue but on line 790...

warning: array_pop() [function.array-pop]: The argument should be an array in /Users/qbnflaco/Sites/acquia-drupal-site/acquia-drupal/modules/acquia/date/date_api.module on line 790.

I'll check if the same thing works for me.

grendzy’s picture

Same error here, on a fresh install with
Drupal 6.15
Content Construction Kit (CCK) 6.x-2.6
Date 6.x-2.4

Interestingly, resubmitting the field settings page (/admin/content/node-type/page/fields/field_datestamp) resolved the error.

adrianmoya’s picture

I has the same error, and can confirm that resubmitting the settings for the field resolves the problem.

Just my 2 cents...

imrook’s picture

I recently had this occur to me after upgrading a site from D5 to D6. Resubmitting the form also fixed the problem for me.

jimmynash’s picture

I also saw this particular problem.
Drupal 6.16
Date Api 6.x-2.4
CCK 6.x-2.7

Resubmitting the configuration for the field also fixed the issue. I am unsure if it affected all node instances with that field on them, I don't think it did.

The only change that I can see that happened was that a user placed a very malformed link into the URL Path field and saved the node.

sammyframson’s picture

Resubmitting also worked for me.

damienmckenna’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Unfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.