Problem/Motivation

Deprecated function: Using null as an array offset is deprecated, use an empty string instead in Drupal\pathauto\PathautoGenerator->getPatternByEntity() (line 368 of modules/contrib/pathauto/src/PathautoGenerator.php).

Deprecated function: Using null as an array offset is deprecated, use an empty string instead in Drupal\pathauto\PathautoGenerator->getPatternByEntity() (line 371 of modules/contrib/pathauto/src/PathautoGenerator.php).

Issue fork pathauto-3616056

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

trickfun created an issue. See original summary.

chaitanyadessai made their first commit to this issue’s fork.

chaitanyadessai’s picture

Status: Active » Needs review

Thanks for the report and patch. Looking at the issue fork branch (3616056-deprecated-function-using), this is already resolved commit 3d62a74 (landed for #3579655, "Deprecated error with PHP 8.5 on entity forms without pathauto patterns") restructured getPatternByEntity() to check $entity->isNew() and return early before any array indexing happens, so $entity->id() is never used as an array offset for new/unsaved entities anymore. That's the same root cause this issue describes ($entity->id() returning NULL for new entities), just fixed via a different, more thorough refactor than the attached patch.

lisotton’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3579655: Deprecated error with PHP 8.5 on entity forms without pathauto patterns.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.