Warning: Undefined array key "pathauto" in Drupal\domain_path_pathauto\DomainPathautoHelper

Created on 17 October 2022, about 2 years ago
Updated 31 March 2023, over 1 year ago

Problem/Motivation

The following errors are thrown when a node is saved when Domain Path Pathauto is enabled but there are no pathauto patterns for the content type.

    Warning: Undefined array key "pathauto" in Drupal\domain_path_pathauto\DomainPathautoHelper->validateAlteredForm() (line 159 of modules/contrib/domain_path/modules/domain_path_pathauto/src/DomainPathautoHelper.php).
    Warning: Undefined array key "pathauto" in Drupal\domain_path_pathauto\DomainPathautoHelper->validateAlteredForm() (line 159 of modules/contrib/domain_path/modules/domain_path_pathauto/src/DomainPathautoHelper.php).
    Warning: Undefined array key "pathauto" in Drupal\domain_path_pathauto\DomainPathautoHelper->submitAlteredEntityForm() (line 226 of modules/contrib/domain_path/modules/domain_path_pathauto/src/DomainPathautoHelper.php).
    Warning: Undefined array key "pathauto" in Drupal\domain_path_pathauto\DomainPathautoHelper->submitAlteredEntityForm() (line 226 of modules/contrib/domain_path/modules/domain_path_pathauto/src/DomainPathautoHelper.php).

There have been a number of similar issues fixed, but there are still places in the code there array access is attempted, but there is no check to ensure the key exists.

Steps to reproduce

  • Enable Domain Path Pathauto and all dependencies.
  • Ensure there isn't a Pathuto pattern for a content type.
  • Create a new node of that content type.
  • See the warnings in the logs.

Proposed resolution

Check the array keys exist before trying to access them.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom stephen-cox

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024