Been seeing these warnings on a site that was upgraded from DP6. When I dug into the code the warnings are occurring when the function is called with an array() argument, works fine if called with a null argument. Of more concern is that it seems the this->granularity is not having members unset as required. That is regardless of setting granularity to just year,month,day this->granularity always has all fields.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Louis Delacretaz created an issue. See original summary.

Louis Delacretaz’s picture

Attached is a patch that resolves both warnings and properly unsets the granularity properties

Gik000’s picture

This patch just hides warnings, does not resolve any issue.

My problem appear when I try to use drupal_get_form or ajax to load a form in which date field is set

the message is:

Warning: in_array() expects parameter 2 to be array, null given in DateObject->limitGranularity()

I have verified that this happens because $granularity is void.
Thi value is passed to limitGranularity from the function date_default_date in date_api_elements.inc,
in which the variable $element does not have the index $element['#date_format'] filled properly (it is void) so granularity is void too.

$granularity = date_format_order($element['#date_format']);

anyway I'm trying to solve this issue, I will let you know.

DamienMcKenna’s picture

Version: 7.x-2.9-rc1 » 7.x-2.x-dev
Status: Active » Needs review
RoSk0’s picture