First off, let me state that everything works correctly right now. So this is technically not yet a bug for the Date module, but might be in the future. The problem is that there is a pending core bug fix that is going to, I think, trigger this issue for everyone. See #1588138: pager_query_add_page() [in D7, theme_pager_link()] overrides parameters passed programmatically. I ran into the issue because the Pagerer module has already fixed this core bug.

I am using a date field, with granularity set to year only. I then have an exposed Views filter using a select list. The name attribute on the form element is like:

name="field_example_date[value][year]"

What I would expect to see is more like:

name="field_example_date[year]"

The core bug is found in theme_pager_link.
With the core bug in place, theme_pager_link seems to correctly generate pager links (previous/next) for this 3-level array. The links put field_example_date[value][year]=2016 into the link's query parameter.

When the core bug is fixed, there will be a fatal error triggered instead:

Fatal error: Cannot create references to/from string offsets nor overloaded objects in .../includes/common.inc on line 6754

The last few rows of the call stack are:

24	0.8698	49237488	drupal_process_form( )	../form.inc:386
25	0.8698	49241280	form_builder( )	../form.inc:886
26	0.8708	49256008	form_builder( )	../form.inc:1927
27	0.8709	49261160	form_builder( )	../form.inc:1927
28	0.8751	49330744	form_builder( )	../form.inc:1927
29	0.8753	49331296	_form_builder_handle_input_element( )	../form.inc:1865
30	0.8754	49331760	drupal_array_set_nested_value( )	../form.inc:2098

I believe that if the date select form element was using a two-dimensional name like name="field_example_date[year]", instead of three-dimensional name, this fatal error would not happen.

I have no idea if name="field_example_date[value][year]" is the correct way of building the form element and maybe theme_pager_link needs to handle this situation better. I also have no idea how to get form_builder to generate name="field_example_date[year]" instead.

My goal with this issue to bring this potential problem to light.

Comments

JonMcL created an issue.