The View contains:
Format: Table
Fields: (Title), (Date), (Category), (Type) and (File)
Filter Criteria Content: Published (Yes), Content: Type (Documents), Content: Date (Exposed Select Day)

Configure filter criterion: Content: Date (field_doc_date)
Appears in: node:Documents.
Expose this filter to visitors, to allow them to change it: CHECKED

Filter type to expose: Single filter: RADIO Selected
Operator: "Is Between"

________: Select a date > Month | Day | Year
Start date: Select a date > Month | Day | Year
End date: Enter a relative date > now +1 month

MORE
Administrative title:
Filter identifier > field_doc_date_value

Which does appear in the URL after the ? to identify this filter.

I feel that this error is due to the "Start Date" being empty upon the initial rendering.
After the initial rendering, the end user may select the "Date" column in order to sort the table without selecting a Start Date.

This causes the URL to send the request as: all?field_priv_doc_date_value[min]&field_priv_doc_date_value[max]&order=field_priv_doc_date&sort=asc

and following error is displayed:
Warning: Illegal string offset 'month' in date_select_element_value_callback() (line 467 of /home/www/html/precise/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Cannot assign an empty string to a string offset in date_select_element_value_callback() (line 467 of /home/www/html/precise/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Illegal string offset 'day' in date_select_element_value_callback() (line 467 of /home/www/html/precise/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Cannot assign an empty string to a string offset in date_select_element_value_callback() (line 467 of /home/www/html/precise/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Illegal string offset 'year' in date_select_element_value_callback() (line 467 of /home/www/html/precise/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Cannot assign an empty string to a string offset in date_select_element_value_callback() (line 467 of /home/www/html/precise/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Illegal string offset 'month' in drupal_array_set_nested_value() (line 6794 of /home/www/html/precise/includes/common.inc).
Error: Cannot create references to/from string offsets in drupal_array_set_nested_value() (line 6794 of /home/www/html/precise/includes/common.inc).

The function is looking for the [min][month], [min][day], [min][year], [max][month], [max][day] and [max][year].

If the Start Date is set to a value (e.g. 1/1/2019), it causes the URL to send the request as all?field_priv_doc_date_value[min][month]=1&field_priv_doc_date_value[min][day]=1&field_priv_doc_date_value[min][year]=2019&field_priv_doc_date_value[max][month]=6&field_priv_doc_date_value[max][day]=16&field_priv_doc_date_value[max][year]=2019

and then the error does not display.

Comments

stevecory created an issue. See original summary.

damienmckenna’s picture

Issue tags: -Drupal 7.67, -DB 5.5.60-MariaDB, -PHP 7.2.16, -Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips

First off, I'm sorry you're having this problem. Could you please try the latest 7.x-3.23 release and let us know if that resolves the problem? Thanks.

stevecory’s picture

Thank you for your response. The system received the latest update 7.x-3.23 release and it did not resolve the problem.

Update information last refreshed: Fri, 05/17/2019 - 3:04pm
Name Installed Version Proposed version Message
Views (views) 7.x-3.22 7.x-3.23 Update available

Code updates will be made to the following projects: Views [views-7.x-3.23]

Note: A backup of your project will be stored to backups directory if it is not managed by a supported version control system.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue with the update process? (y/n): y
Project views was updated successfully. Installed version is now 7.x-3.23.
Backups were saved into the directory /root/drush-backups//20190517190440/modules/views. [ok]
No database updates required [success]
'all' cache was cleared.

The URL sent the request as:
all?field_doc_date_value[min]&field_doc_date_value[max]&order=field_doc_date&sort=asc
and the following error is displayed:

Warning: Illegal string offset 'month' in date_select_element_value_callback() (line 467 of /home/www/html/atn/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Cannot assign an empty string to a string offset in date_select_element_value_callback() (line 467 of /home/www/html/atn/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Illegal string offset 'day' in date_select_element_value_callback() (line 467 of /home/www/html/atn/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Cannot assign an empty string to a string offset in date_select_element_value_callback() (line 467 of /home/www/html/atn/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Illegal string offset 'year' in date_select_element_value_callback() (line 467 of /home/www/html/atn/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Cannot assign an empty string to a string offset in date_select_element_value_callback() (line 467 of /home/www/html/atn/sites/all/modules/date/date_api/date_api_elements.inc).
Warning: Illegal string offset 'month' in drupal_array_set_nested_value() (line 6794 of /home/www/html/atn/includes/common.inc).
Error: Cannot create references to/from string offsets in drupal_array_set_nested_value() (line 6794 of /home/www/html/atn/includes/common.inc).

stevecory’s picture

I tried not setting the Start Date and just selecting the "Apply" button.
It causes the URL to send the request as all?field_priv_doc_date_value[min][month]=&field_priv_doc_date_value[min][day]=&field_priv_doc_date_value[min][year]=&field_priv_doc_date_value[max][month]=&field_priv_doc_date_value[max][day]=&field_priv_doc_date_value[max][year]=&order=field_doc_date&sort=asc

and the error does not display.

ciss’s picture

StatusFileSize
new42.72 KB

We've noticed the same problem after performing a Views update from cf53b40 to 2c4f62a (and switching from PHP 5 to PHP 7). For an exposed form with a number range filter "a" (a[min], a[max]), if the query string contains "a=foo", Drupal will attempt to set the value for the key "min" on the input string "foo":

Relevant snippet in _form_builder_handle_input_element():

if ($process_input) {
      // Get the input for the current element. NULL values in the input need to
      // be explicitly distinguished from missing input. (see below)
      $input_exists = NULL;
      $input = drupal_array_get_nested_value($form_state['input'], $element['#parents'], $input_exists);
      // For browser-submitted forms, the submitted values do not contain values
      // for certain elements (empty multiple select, unchecked checkbox).
      // During initial form processing, we add explicit NULL values for such
      // elements in $form_state['input']. When rebuilding the form, we can
      // distinguish elements having NULL input from elements that were not part
      // of the initially submitted form and can therefore use default values
      // for the latter, if required. Programmatically submitted forms can
      // submit explicit NULL values when calling drupal_form_submit(), so we do
      // not modify $form_state['input'] for them.
      if (!$input_exists && !$form_state['rebuild'] && !$form_state['programmed']) {
        // Add the necessary parent keys to $form_state['input'] and sets the
        // element's input value to NULL.
        drupal_array_set_nested_value($form_state['input'], $element['#parents'], NULL);
        $input_exists = TRUE;
      }
entropea’s picture

We were experiencing this issue and changed the form element of the filter from "text" to "popup" and this resolved the sorting issue.

lolcode’s picture

We experienced this issue in D8 when a views block display with an exposed form was rendered in a core block entity reference field.
The block rendered OK but gave this error on the edit form.

adpo’s picture

Hello, I have the same problem with DATE filters for D7 VIEWS and custom DB table table,

$data['bo_online_sample_requests']['timestamp'] = array(
    'title' => t('Timestamp'),
    'help' => t('Timestamp '),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
  );

Database structure:
timestamp int(11)
Everying was fine until latest Drupal / Views upgrade. (edited)

norgef’s picture

---

damienmckenna’s picture

Version: 7.x-3.22 » 7.x-3.x-dev
alen simonyan’s picture

Hi, I have created an issue https://www.drupal.org/project/drupal/issues/3458997, because the search didn't show this one.

I managed to fix this error with this patch.