Problem/Motivation

Version 3.x works fine so far, the queries for agreements follow, are saved etc pp. I wanted to customize the view slightly to my own requirements, this is unfortunately not mögich and ends with a WSOD under Drupal 9.5.9 & 10.1 with PHP 8.1.

Here is the error message:

Warning: Undefined array key "" in /var/www/html/docroot/core/modules/views_ui/src/ViewFormBase.php on line 162

Warning: Trying to access array offset on value of type null in /var/www/html/docroot/core/modules/views_ui/src/ViewFormBase.php on line 162
The website encountered an unexpected error. Please try again later.

TypeError: views_ui_truncate(): Argument #1 ($string) must be of type string, null given, called in /var/www/html/docroot/core/modules/views_ui/src/ViewFormBase.php on line 163 in views_ui_truncate() (line 348 of core/modules/views_ui/views_ui.module).
Drupal\views_ui\ViewFormBase->getDisplayLabel(Object, NULL, ) (Line: 411)
Drupal\views_ui\ViewEditForm->getDisplayDetails(Object, Array) (Line: 383)
Drupal\views_ui\ViewEditForm->getDisplayTab(Object) (Line: 212)
Drupal\views_ui\ViewEditForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 41)
Drupal\views_ui\ViewFormBase->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('view_edit_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 230)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, NULL)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  • Using an existing site from a prior version of Drupal
  • call/edit the view /admin/structure/views/view/user_agreements

Proposed resolution

1. Write a post-update hook to update config objects.
2. Update optional configuration to Drupal 10.

Remaining tasks

- Create issue fork/merge request fixing 1-2 above.

API changes

No

Data model changes

No, but newer versions will only support >10.

Issue fork agreement-3372652

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

zcht created an issue. See original summary.

mradcliffe’s picture

Status: Active » Postponed (maintainer needs more info)

Thank you for reporting the issue.

Do you have more details about what exactly you were changing?

I tried to reproduce and I was able to edit and save the view after making changes.

slowflyer’s picture

I cant edit the view as well. When trying to edit I receive on Drupal 10.2.4, php 8.2:

Error: Call to a member function isEnabled() on null in Drupal\views_ui\ViewEditForm->getDisplayDetails() (line 421 of core/modules/views_ui/src/ViewEditForm.php).

Drupal\views_ui\ViewEditForm->getDisplayTab(Object) (Line: 212)
Drupal\views_ui\ViewEditForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 41)
Drupal\views_ui\ViewFormBase->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('view_edit_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 230)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, NULL)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

mradcliffe’s picture

Priority: Critical » Normal

Hmm, I am still having trouble reproducing this issue.

I launched DrupalPod with Drupal 10.2.4 and switched to using PHP 8.2.

However I think what may help on your site, if you export your configuration via the Configuration > Development > Configuration Synchronization > Import interface, you may be able to update the YAML manually.

I exported the configuration out of DrupalPod successfully as the following. Try importing the following YAML after updating the first line here. If that works, then I think I have a path forward.

It's possible that on an existing site views did not update all the views or a database update/post-update for views went wrong causing malformed data.

uuid: USE_UUID_FROM_YOUR_OWN_SITES_USER_AGREEMENTS_VIEW
langcode: en
status: true
dependencies:
  module:
    - agreement
    - user
id: user_agreements
label: 'User Agreements'
module: agreement
description: 'List agreement records for an user in a tab on their user profile.'
tag: ''
base_table: users_field_data
base_field: uid
display:
  default:
    id: null
    display_title: Master
    display_plugin: default
    position: 0
    display_options:
      title: 'My Agreements'
      fields:
        type:
          id: type
          table: agreement
          field: type
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: agreement_entity
          label: Agreement
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: true
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: true
          empty_zero: false
          hide_alter_empty: true
          display:
            - label
        agreed_date:
          id: agreed_date
          table: agreement
          field: agreed_date
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: date
          label: 'Agreed On'
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: true
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: true
          empty_zero: false
          hide_alter_empty: true
          date_format: html_date
          custom_date_format: ''
          timezone: ''
      pager:
        type: mini
        options:
          offset: 0
          items_per_page: 50
          total_pages: null
          id: 0
          tags:
            next: ››
            previous: ‹‹
          expose:
            items_per_page: false
            items_per_page_label: 'Items per page'
            items_per_page_options: '5, 10, 25, 50'
            items_per_page_options_all: false
            items_per_page_options_all_label: '- All -'
            offset: false
            offset_label: Offset
      exposed_form:
        type: basic
        options:
          submit_button: Apply
          reset_button: false
          reset_button_label: Reset
          exposed_sorts_label: 'Sort by'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      access:
        type: none
        options: {  }
      cache:
        type: tag
        options: {  }
      empty: {  }
      sorts: {  }
      arguments:
        uid:
          id: uid
          table: users_field_data
          field: uid
          relationship: none
          group_type: group
          admin_label: ''
          entity_type: user
          entity_field: uid
          plugin_id: user_uid
          default_action: 'not found'
          exception:
            value: ''
            title_enable: false
            title: All
          title_enable: false
          title: ''
          default_argument_type: fixed
          default_argument_options:
            argument: ''
          summary_options:
            base_path: ''
            count: true
            override: false
            items_per_page: 25
          summary:
            sort_order: asc
            number_of_records: 0
            format: default_summary
          specify_validation: true
          validate:
            type: 'entity:user'
            fail: 'not found'
          validate_options:
            access: true
            operation: update
            multiple: 0
            restrict_roles: false
            roles: {  }
          break_phrase: false
          not: false
      filters:
        status:
          id: status
          table: users_field_data
          field: status
          entity_type: user
          entity_field: status
          plugin_id: boolean
          value: '1'
          group: 1
          expose:
            operator: ''
      style:
        type: table
        options:
          grouping: {  }
          row_class: ''
          default_row_class: true
          columns:
            type: type
            agreed_date: agreed_date
          default: agreed_date
          info:
            type:
              sortable: true
              default_sort_order: asc
              align: ''
              separator: ''
              empty_column: true
              responsive: ''
            agreed_date:
              sortable: true
              default_sort_order: desc
              align: ''
              separator: ''
              empty_column: true
              responsive: ''
          override: true
          sticky: false
          summary: ''
          empty_table: true
          caption: ''
          description: ''
      row:
        type: fields
        options:
          default_field_elements: true
          inline: {  }
          separator: ''
          hide_empty: false
      query:
        type: views_query
        options:
          query_comment: ''
          disable_sql_rewrite: false
          distinct: false
          replica: false
          query_tags: {  }
      relationships: {  }
      header: {  }
      footer: {  }
      display_extenders: {  }
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_interface'
        - url
        - url.query_args
      tags: {  }
  user_agreements:
    id: user_agreements
    display_title: Page
    display_plugin: page
    position: 1
    display_options:
      display_extenders: {  }
      path: user/%user/agreements
      menu:
        type: tab
        title: Agreements
        description: ''
        weight: 0
        expanded: false
        menu_name: account
        parent: user.page
        context: '0'
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_interface'
        - url
        - url.query_args
      tags: {  }
slowflyer’s picture

This causes the error:

display:
  default:
    id: null

This works:

display:
  default:
    id: default
mradcliffe’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active

Thank you for the feedback, I think I have a path forward.

mradcliffe’s picture

Issue summary: View changes
Issue tags: +Novice

Adding the novice task in case I don't take care of this myself in the near future. I think I've outlined the two next steps in the issue to creat ea merge request.

mradcliffe’s picture

Status: Active » Needs review
Issue tags: -Novice

Writing a test isn't going to be possible, but I confirmed with some manual testing in DrupalPod that a post-update adds the missing id.

I updated the default views to be based on Drupal 10.1 exports.

  • mradcliffe committed 29c35383 on 3.0.x
    Issue #3372652 by mradcliffe, slowflyer: Calling the user_agreements...
mradcliffe’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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