I upgraded to dev version to fix this issue: http://drupal.org/node/409476 , so I'm using a custom date format display.

    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.

After ( successfully) creating the content, I get:

   * warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /.../modules/date/date_api_ical.inc on line 568.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /.../modules/date/date_api_ical.inc on line 654.
    * warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /.../modules/date/date_api_ical.inc on line 568.
    * warning: date_format() expects parameter 1 to be DateTime, null given in /.../modules/date/date_api_ical.inc on line 654.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../modules/date/includes/date_api_argument_handler.inc on line 234.

On the calendar view, I get the same. It is also displaying dates for the same content twice. That may have been introduced by a recent upgrade.

Thanks for all your work,
glass.dimly

Comments

binford2k’s picture

I get the same, but viewing the content or calendar seem to work fine. The error only appears in the edit view interface.

binford2k’s picture

I take it back. Somehow the date popup module was uninstalled when I upgraded to -dev.

jsimonis’s picture

We're getting the same thing. Just upgraded to the dev version and we're getting those errors as well. There's a whole list of this error on our calendar page.

Here's my list:


    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_filter_handler.inc on line 514.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_filter_handler.inc on line 514.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_argument_handler.inc on line 234.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_filter_handler.inc on line 514.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/www/users/username/drupal_county/sites/all/modules/date/includes/date_api_argument_handler.inc on line 234.

karens’s picture

Status: Active » Postponed (maintainer needs more info)

Check your modules page to be sure all your modules are still enabled. I'm getting sporadic reports that some modules got disabled during an update.

vince_pl’s picture

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /trening/modules/date/date/date_elements.inc on line 544.

any idea to fix this? I tried last stable 6.x-2.4 and 6.x-2.x-dev with no success, still the same error, i use the Date module with cck and flexifield modules

OliverColeman’s picture

As a work around until this gets fixed properly this seems to work:

Change the following lines in the function date_widget_validate in date/date/date_elements.inc (around line 544):

$field = $form_state['#field_info'][$element['#field_name']];
if (module_exists('date_repeat') &&
isset($form_values[$field_name]) &&
array_key_exists('rrule', $form_values[$field_name])) {
require_once('./'. drupal_get_path('module', 'date') .'/date_repeat.inc');

(the first line and last line are for context).

This dispatches with the error messages when adding a new user and doesn't seem to have bad side effects (ie the hidden fields can be updated properly at a later date).

I'm guessing this is related to #705486: CCK3 and Content Profile module (new registrations).

bneel’s picture

I have the same pb with #6
Any news ?
B

nikunjkotecha’s picture

I am having the same problem
I added is_array condition in between, and it's working for me right now

The line 544 now looks like:
if (module_exists('date_repeat') && is_array($form_values[$field_name]) && array_key_exists('rrule', $form_values[$field_name])) {

thekevinday’s picture

I have the same problem as #8.

In my case this happens with: CCK-3 with multigroup/fieldgroups.

When a date field is placed inside a multigroup field and the form gets submitted the value of the date field gets set to NULL.
(due to a bug in multigroups)

Putting core CCK fields, such as a text field inside of the multigroup also gets set to NULL.

The problem is not that multigroups is broken (this is the cause).
The problem is that you are not checking that a particular variable is an array _before_ calling array_key_exists().

thekevinday’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.89 KB

Here is the fix for #5.

The File: date/date_elements.inc
The Function: date_widget_validate()

The original code simply checks the immediate top-level for form_values for the field by a given name:

<?php
  if (module_exists('date_repeat') && array_key_exists('rrule', $form_values[$field_name])) {
    require_once('./'. drupal_get_path('module', 'date') .'/date_repeat.inc');
    return _date_repeat_widget_validate($element, $form_state);
  }
?>

The problem is multigroups stores the fields inside of a group field, so searching for something at the top-level that is not there will produce a NULL.
The end result is: array_key_exists('rrule', NULL) which is obviously bad.

The solution:
Walk through each group in form_values and search for the field by the given $field_name.
Make sure this is an array and then peform the array_key_exists() test case.

karens’s picture

So is everyone who is seeing this using multigroups with CCK3? If not, there really is not enough information to be able to reproduce the problem (which is the only way I can be sure of the right fix).

I understand the logic of the patch in #10, it would be nice to get some confirmation from anyone else that it fixes their problems. It is also important to have a list of steps to reproduce the problem.

johnjolowe’s picture

I'm getting the same error message using FlexiField 6.x-1.0-alpha5 and CCK 6.x-2.8. The FlexiField contains a datetime field and is used in a content-profile (6.x-1.0.) The error occurs when I save the profile.

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in {...path...}/sites/all/modules/date/date/date_elements.inc on line 540.

Macronomicus’s picture

Status: Needs review » Reviewed & tested by the community

Yay #10 works as advertised.

I was experiencing the issue in the same context as #12 (Flexigroup with a date field) threw tons of erros & #10 fixes it AFAICT.

Cheers!

scjv’s picture

# 10 works fine

todd zebert’s picture

#10 worked for me, thanks! (even made the patch manually)

karens’s picture

Status: Reviewed & tested by the community » Fixed

Committed a much simpler fix:

/**
 * Handle widget processing.
 */
function date_widget_validate($element, &$form_state) {
  $field = $form_state['#field_info'][$element['#field_name']];
  if (module_exists('date_repeat') && $field['repeat'] == 1) {
    module_load_include('inc', 'date', 'date_repeat');
    return _date_repeat_widget_validate($element, $form_state);
  }  
}

Status: Fixed » Closed (fixed)

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