Error in PathAliasUpdater.

Created on 19 September 2023, 9 months ago
Updated 24 September 2023, 9 months ago

Problem/Motivation

Error reported in logs after attempting to save an Association entity:

InvalidArgumentException: Unable to get a value with a non-numeric delta in a list. in Drupal\path\Plugin\Field\FieldType\PathFieldItemList->get() (line 72 of /var/www/docroot/core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡·Costa Rica esolano

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

Comments & Activities

  • Issue created by @esolano
  • Status changed to Needs review 9 months ago
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • πŸ‡¨πŸ‡·Costa Rica esolano
  • πŸ‡ΊπŸ‡ΈUnited States lemming

    Hi @esolano thanks for finding and patching this issue.

    Took me a little bit to remember why this looked so familiar. This was a changed to attempt to appease drupal-check / PHPStan analysis tools.

    50 Access to an undefined property
    Drupal\Core\Field\FieldItemListInterface::$alias.
    πŸ’‘ Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property

    Which in this case is harmless but I wanted to avoid ignoring or having too many of those pile up (makes it harder to wade through actual problems). I was hoping that maybe D10 w/ PHP8 would start using the which would resolve this, but I don't think they are making that change.

    #[\AllowDynamicProperties]
    

    Any of the fixes that make drupal-check happy really complicate the code and hurts readability, so we should tell the analysis tool to ignore it for now. Could you adjust your patch to add the PHPStan ignore before both of those lines:

    /* @phpstan-ignore-next-line */

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • πŸ‡¨πŸ‡·Costa Rica esolano

    Hi @lemming thanks for the explanation and reviewing the patch. Here's the change you requested.

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States lemming
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • @lemming opened merge request.
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024