When I am using a view with date popup picker it works fine. But as soon as I go to page two I get this warnings.
Warnings

Warning: Illegal string offset 'date' in date_popup_process_date_part() (Zeile 370 von /var/www/learnattack/src/sites/all/modules/contrib/date/date_popup/date_popup.module).
Warning: Illegal string offset 'time' in date_popup_process_time_part() (Zeile 446 von /var/www/learnattack/src/sites/all/modules/contrib/date/date_popup/date_popup.module).
Warning: Illegal string offset 'time' in date_popup_process_time_part() (Zeile 507 von /var/www/learnattack/src/sites/all/modules/contrib/date/date_popup/date_popup.module).
Warning: Illegal string offset 'date' in date_popup_process_date_part() (Zeile 370 von /var/www/learnattack/src/sites/all/modules/contrib/date/date_popup/date_popup.module).
Warning: Illegal string offset 'time' in date_popup_process_time_part() (Zeile 446 von /var/www/learnattack/src/sites/all/modules/contrib/date/date_popup/date_popup.module).
Warning: Illegal string offset 'time' in date_popup_process_time_part() (Zeile 507 von /var/www/learnattack/src/sites/all/modules/contrib/date/date_popup/date_popup.module).

Further there are no results anymore and the fields where I entered my dates are empty and time fields have a strange symbol.

I am using a view with more than one date picker.

But the problem is that $element ['#value'] is always a string and not an array - line 370 and 446.

if (!isset($element['#value']['date']) && isset($callback_values['date'])) {
    $element['#value']['date'] = $callback_values['date']; //line 370
  }

if (!isset($element['#value']['time']) && isset($callback_values['time'])) {
    $element['#value']['time'] = $callback_values['time']; //line 446
  }

Update:I think the pagination messes something up.
This is the url when I use the filter:
/admin/people/authenticated?field_firstname_value=&field_lastname_value=&mail=&status=1&field_role_value=All&field_state_value=All&field_gender_value=All&field_school_type_value=All&field_comment_value=&date_filter%5Bmin%5D%5Bdate%5D=10%2F07%2F2015&date_filter%5Bmin%5D%5Btime%5D=10%3A51&date_filter%5Bmax%5D%5Bdate%5D=10%2F25%2F2015&date_filter%5Bmax%5D%5Btime%5D=01%3A47&date_filter_1%5Bmin%5D%5Bdate%5D=&date_filter_1%5Bmin%5D%5Btime%5D=&date_filter_1%5Bmax%5D%5Bdate%5D=&date_filter_1%5Bmax%5D%5Btime%5D=&field_marketing_agreement_value=All&field_productspecific_marketing_value=All&rid_1=All&field_channel_value=
And this is the url when I use pagination to page 2:
/admin/people/authenticated?field_firstname_value=&field_lastname_value=&mail=&status=1&field_role_value=All&field_state_value=All&field_gender_value=All&field_school_type_value=All&field_comment_value=&date_filter[min]=2015-10-07%2010%3A51&date_filter[max]=2015-10-25%2001%3A47&date_filter_1[min]&date_filter_1[max]&field_marketing_agreement_value=All&field_productspecific_marketing_value=All&rid_1=All&field_channel_value=&page=1

As you can see the important part is:
Good: date_filter[min][date]=10/07/2015&date_filter[min][time]=10:51&date_filter[max][date]=10/25/2015&date_filter[max][time]=01:47
Bad: date_filter[min]=2015-10-07 10:51&date_filter[max]=2015-10-25 01:47

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jurik created an issue. See original summary.

Jurik’s picture

Issue summary: View changes

I updated this issue. While debugging I figured out that the pagination might be the problem.

DamienMcKenna’s picture

DamienMcKenna’s picture

I think the errors stem from not checking if $element['#value'] is an array before checking the 'date' value.

How does this work?

Michelle’s picture

I was not able to reproduce this. These are the steps I took:

- Enabled date as well as the date popup and views integration.
- Created a content view with two exposed date filters.
- Added enough content to make it paginate.
- Entered in values in the filters and went to the second page.

It seemed to work just fine with no errors. Did I miss anything?

torgosPizza’s picture

daniel_j’s picture

I think there was a typo in the patch attached to #6. Rather than this:

$element['#value'] = $callback_values['date'];

I think we want this:

$element['#value']['date'] = $callback_values['date'];

The attached patch accomplishes this. Without this fix, I get zero results in every query that has an exposed date filter, because an array is being passed as a parameter to the underlying SelectQuery instead of a string.

Siggy’s picture

Had a similar issue on the time part as well, because when $element['#value'] = '' , then it can not convert it to an array anymore (in php7.x)

Not sure this is the best way.

Status: Needs review » Needs work

The last submitted patch, 10: date-n2601110-10.patch, failed testing. View results

Siggy’s picture

Siggy’s picture

torgosPizza’s picture

Status: Needs work » Needs review

Anytime you post a new patch, you'll want to set the metadata to Needs review so the Testbot can run :)

The last submitted patch, 12: date-n2601110-12.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 13: date-n2601110-13.patch, failed testing. View results