TypeError: Cannot access offset of type string on string in date_views_filter_handler_simple

Created on 21 July 2023, over 1 year ago

I have updated my site to PHP 8.0 and I'm still getting this error despite having the latest release of date.

TypeError: Cannot access offset of type string on string in date_views_filter_handler_simple->accept_exposed_input() (line 150 of /var/www/html/docroot/sites/all/modules/date/date_views/includes/date_views_filter_handler_simple.inc).

I get the error anytime I'm trying to edit any node that includes a date field.

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

3.0

Component

Code

Created by

🇺🇸United States museumboy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @museumboy
  • 🇺🇸United States museumboy

    The fatal error only occurs when my view includes an exposed filter that is NULL or is NOT NULL.

  • 🇮🇳India rahul_ Alirajpur

    @museumboy -
    Temporary Fix -
    Please do following changes and issue will resolve
    In File /home/ide/project/docroot/sites/all/modules/contrib/date/date_views/includes/date_views_filter_handler_simple.inc
    Replace

     $element_input['value'] = $this->get_filter_value('value', !empty($element_input['value']) ? $element_input['value'] : '');
     $element_input['min'] = $this->get_filter_value('min', !empty($element_input['min']) ? $element_input['min'] : '');
     $element_input['max'] = $this->get_filter_value('max', !empty($element_input['max']) ? $element_input['max'] : '');
    

    To

          if(isset($element_input['value']))
          $element_input['value'] = $this->get_filter_value('value', !empty($element_input['value']) ? $element_input['value'] : '');
    
          if (isset($element_input['min']))
          $element_input['min'] = $this->get_filter_value('min', !empty($element_input['min']) ? $element_input['min'] : '');
    
          if (isset($element_input['max']))
          $element_input['max'] = $this->get_filter_value('max', !empty($element_input['max']) ? $element_input['max'] : '');
    

    I will create a Patch and share with you.

    Please let me know if after this changes you are facing similar issue.

Production build 0.71.5 2024