Hi,

I had the warning message: Warning : array_filter() [function.array-filter]: The first argument should be an array dans date_select_input_date() (ligne 699 ... all/modules/date/date_api/date_api_elements.inc

I changed the date_api_elements.inc file like this @ line 699:

if(!is_array($input)){
$entered = NULL;
} else {
$entered = array_values(array_filter($input));
}

The error message is no more present.
Regards.

Francisco.

Comments

JoshOrndorff’s picture

I'm getting the same problem using an exposed date filter in views 7.x-3.1

Is this the proper fix?

JoshOrndorff’s picture

Version: 7.x-2.0-rc2 » 7.x-2.x-dev

And it is still happening in the -dev as of 02 February 2012.

jlpicard2’s picture

After updating to Date RC2, I was getting the error on Views pages with a default date of "now".

• Warning: array_filter() expects parameter 1 to be array, null given in date_select_input_date() (line 699 of /var/www/html/sites/all/modules/date/date_api/date_api_elements.inc).
• Warning: array_values() expects parameter 1 to be array, null given in date_select_input_date() (line 699 of /var/www/html/sites/all/modules/date/date_api/date_api_elements.inc).

The fix above corrects these warnings.

phoang’s picture

Version: 7.x-2.x-dev » 7.x-2.0-rc2

Subscribe. I'm having same issue when updating to RC2.

extrarumeno’s picture

subscribe

same error To RC2

sgabe’s picture

I can confirm the error.

sgabe’s picture

Status: Active » Needs review
StatusFileSize
new790 bytes

See the attached patch.

kkasischke’s picture

Patch in #7 worked for me. Thanks!

gaele’s picture

Status: Needs review » Reviewed & tested by the community

Yup.

bschilt’s picture

Patch in #7 worked for me too.

goliat2’s picture

Assigned: Unassigned » goliat2

doesn't work for me ! please help !
#7 creates "internal error"

SilviuChingaru’s picture

Patch in #7 worked fine for me too. Thank you!

gaele’s picture

Assigned: goliat2 » Unassigned

goliat2, if you see an "internal error" the error_log of the webserver should provide a clue of what went wrong.
Please share that information with us.

karens’s picture

Status: Reviewed & tested by the community » Needs work

I can't tell if this is the right patch or if something else needs to be done unless someone can tell me how to reproduce the error. I don't have any such error.

goliat2’s picture

Thanks for the tip #13 and it seems to be a PHP Parse error.
Could someone attach the entire file "date_api_elements.inc" so that i can download it and test it ?
Thanks

Blooniverse’s picture

Title: array_filter() -- first argument should be an array in date_select_input_date() » Warning : array_filter() [function.array-filter]: The first argument should be an array dans date_select_input_date() (ligne 699

@goliat2#15: Just download the latest dev version (2012-02-09) from http://ftp.drupal.org/files/projects/date-7.x-2.x-dev.zip respectively http://drupal.org/project/date ! The current commits/patches should be in there. Or ... did you want to get the fully patched 'date_api_elements.inc' due to not knowing how patching works? Then please consult http://drupal.org/node/707484 or http://drupal.org/node/620014 or http://drupal.org/node/60108, depending on your aims.

Blooniverse’s picture

Title: Warning : array_filter() [function.array-filter]: The first argument should be an array dans date_select_input_date() (ligne 699 » array_filter() -- first argument should be an array in date_select_input_date()

@goliat2#15: The user/browser script 'Dreditor' (http://drupal.org/project/dreditor) can be of great help when working with patches, by the way. It serves as a visual patch reviewer directly inside the browser, which makes life easier.

Blooniverse’s picture

Title: Warning : array_filter() [function.array-filter]: The first argument should be an array dans date_select_input_date() (ligne 699 » array_filter() -- first argument should be an array in date_select_input_date()
StatusFileSize
new5.89 KB

The patch 'date-1425774-7.patch' from @sgabe#7 does get rid of the error message in my case. But it does not solve the pager issue explained in #1433518: Filter & pager influence view result -- but not mutually each other ! The query string arguments / array elements still only consist of keys, but there are no values -- in the mentioned context of a View in combination with an exposed filter (a date field, select form element). This does not happen when I make use of the popup form element!!!

@goliat2#15: If you want to make use of the patched file 'date_api_elements.inc' (7.x-2.0-rc2), please download the zipped attachment from here.

goliat2’s picture

Thank you very much for your help.
I'm not sure i've understood everything about patches but i download your file and uploaded it on my website.
You're right it works only with pop up and text but not on select.
But i would like in my case to make it work on select.
Hope it will be fixed soon !
But thanks again

Blooniverse’s picture

@goliat2#19: You're welcome! You will see, in a few days [or weeks] you will be able to manage the drupal.org issue workflow easier. Besides, I would like to improve my #16-hint: The complete Git instructions are usually found on http://drupal.org/project/foo/git-instructions, in this case http://drupal.org/project/date/git-instructions ! Here it is as well where a section about the patching procedure can be found.

SilviuChingaru’s picture

There is still one problem (maybe feature request for some but I see it more a bug):
If only start date is set and end date is not set, data should be filtered from start date to now().
If only end date is set and start date is not set, start date timestamp should be set to 0.
I think this should be normal behavior.

Anonymous’s picture

Had the same problem with a date select fliter on a view with granularity year (single date select). Patch #7 solved this, thanks. I think #21 is a point for discussion elsewere.

karens’s picture

Note that nothing will happen with this patch unless someone responds to #14.

gaele’s picture

StatusFileSize
new21.32 KB

KarenS, this is my view that produces the warning.

sgabe’s picture

@KarenS: As mentioned in #1, using an exposed filter produced the error.

I have a view with events and an exposed date filter set to use only the year as a select list, so the user can list events for a specific year. The error message occurs when I load the page the first time and the filter has it's default value and no user input. If I choose another year then the error goes away.

The patch eliminates this error.

karens’s picture

Status: Needs work » Fixed

OK, finally got where I could see this. Thanks!

http://drupalcode.org/project/date.git/commit/b8da004

Blooniverse’s picture

w00t — and very likely already in '7.x-2.x-dev'!?!

rafinskipg’s picture

Patch in #7 worked for me

JoshOrndorff’s picture

Version: 7.x-2.0-rc2 » 7.x-2.1

I just upgraded to 7.x-2.1, and the original message is fixed, but is replaced with:

Notice: Undefined index: value in date_views_select_validate() (line 335 of /home2/lufttabl/public_html/joshorndorff.com/sites/all/modules/date/date_views/date_views.module).

karens’s picture

#29 is a totally different issue. If you have a different message you have a different issue.

Blooniverse’s picture

... #29 sounds familiar, sounds like one of many lacking isset()s!

rylowry@gmail.com’s picture

#29 - I'm also having this problem.

I have an exposed filter for choosing nodes within a date range. I'm on version 7.x-2.2. Is this a new issue altogether?

rylowry@gmail.com’s picture

Here is a workaround I used for the problem described in #29. I don't know what caused the problem in the first place, but if you really want to get rid of the warning, this worked for me.

function hook_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && isset($form['field_your_date_field'])) {
    $form['field_your_date_field']['value']['#date_format'] = 'Y-M-d';
  }
}

Status: Fixed » Closed (fixed)

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