Better error handling with invalid handlers in views

Created on 10 June 2015, almost 10 years ago
Updated 30 May 2025, 4 days ago

Nothing prevents display_handler to be invalid in a view, so null reference exceptions occur later in the execution. My guess is that we should validate on creation and throw a proper exception before going too far on the execution.

PHP Fatal error:  Call to a member function getPlugin() on a non-object in /core/modules/views/src/ViewExecutable.php on line 799

PHP  17. Drupal\Core\Extension\ModuleInstaller->install() /core/includes/install.core.inc:1630
PHP  18. Drupal\Core\Config\ConfigInstaller->installDefaultConfig() /core/lib/Drupal/Core/Extension/ModuleInstaller.php:244
PHP  19. Drupal\Core\Config\ConfigInstaller->createConfiguration() /core/lib/Drupal/Core/Config/ConfigInstaller.php:129
PHP  20. Drupal\Core\Entity\Entity->save() /core/lib/Drupal/Core/Config/ConfigInstaller.php:292
PHP  21. Drupal\Core\Config\Entity\ConfigEntityStorage->save() /core/lib/Drupal/Core/Entity/Entity.php:330
PHP  22. Drupal\Core\Entity\EntityStorageBase->save() /core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:238
PHP  23. Drupal\views\Entity\View->preSave() /core/lib/Drupal/Core/Entity/EntityStorageBase.php:408
PHP  24. Drupal\Core\Config\Entity\ConfigEntityBase->preSave() /core/modules/views/src/Entity/View.php:284
PHP  25. Drupal\views\Entity\View->calculateDependencies() /core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:331
PHP  26. Drupal\views\ViewExecutable->initStyle() /core/modules/views/src/Entity/View.php:270

I discovered this by editing manually a view and setting an invalid display_plugin name.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

views.module

Created by

πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024