Closed (fixed)
Project:
Pathauto
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
17 Mar 2026 at 09:52 UTC
Updated:
5 Jul 2026 at 10:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
gashunk commentedComment #4
gashunk commentedComment #5
mably commentedCan you give us a full reproducible scenario on a fresh Drupal instance please (Drupal version, PHP version, etc.)?
I haven't been able to reproduce the problem locally.
Could you eventually share the full stack trace of the warning you get?
Comment #6
gashunk commentedHey I can reproduce this using:
Fresh DDEV setup
PHP Version 8.5
Drupal Version ~11.3.0
Only installed Pathauto module
Edit a content type with URL-Alias in the form BUT without a pattern.
Full stack trace:
Hopes that helps!
Comment #7
vinodhini.e commentedHi, Tested on Drupal 11.2.3 with PHP 8.3.21 using a fresh DDEV setup and installed Pathauto module.
Followed the steps:
Content → Media → Add a media item. The media uploaded successfully, and no deprecated warning appeared.
Could you clarify if any additional setup is needed to reproduce this issue? Thanks.
Comment #8
gashunk commentedI updated the description to further pin the issue.
Comment #9
gashunk commentedComment #10
phoang commentedPatch works on 1.x-dev but not applies to 8.1.14
+1 RTBC
Comment #11
ewout goosmannHi,
I had the same issue on php8.5 and pathauto 8.1.14, so I created a patch.
Comment #12
joegraduateIs this issue possibly a duplicate of #3576435: PHP 8.5 deprecation?
Comment #13
joegraduateComment #14
pasan.gamage commentedUpdated patch to work with release 8.x-1.14 PHP 8.5
Comment #15
pasan.gamage commented@joegraduate
Since #3576435 is already closed we may need to fix this here.
Comment #16
berdirThis is almost certainly a duplicate. That was fixed recently and isn't released yet.
Comment #17
albert.garcia commentedI installed version 1.15 of the module (I think this is the one that @berdir is referring to), but this error keeps happening.
Comment #18
mably commentedPosted MR !173 as a sibling to !169 with a slightly different approach for the maintainers to choose from.
!169 fixes the symptom by coercing
$entity->id() ?? 0and$langcode ?: '', which makes the deprecation go away but caches every unsaved entity of a given type under the same[$entity_type_id][0]slot. !173 instead short-circuits at the top ofgetPatternByEntity()when$entity->isNew()and skips the per-id cache entirely for new entities — matching the intent that was already present in the existingif ($entity->isNew()) { return $pattern; }early return inside the loop. The language-override block is extracted into a small helper to avoid duplication between the two branches.Both MRs make the PHP 8.5 deprecation go away; !173 removes it at the structural level rather than masking it with coercion, and avoids the shared-
0-slot caching question for requests that build several unsaved entities of the same type (e.g. anywherePathautoState::getValue()orPathautoWidget::formElement()is called).Reviews welcome on either or both. Happy to fold ideas back into !169 or close !173 if !169 is preferred.
Comment #22
mably commentedComment #23
mably commentedI can confirm that I’ve successfully reproduced the issue and that MR 173 resolves it.
Comment #24
joegraduateAttaching current MR !173 diff as patch usable with composer for 8.x-1.15.
Comment #25
herved commentedI'd vote for MR173, LGTM, thanks
Comment #26
pfrenssenI like the approach in !173 too. The flow is also more easy to understand now, because we do an early return when the entity is new. Previously this check was nested inside the loop.
Nitpick: I would remove the line "This avoids using NULL as an array offset, which is deprecated in PHP 8.5+." in the documentation, because this assumes the reader would be familiar with the previous code having a NULL array offset, and is somehow in need for an explanation about why this is now missing :)
edit: I updated the documentation in the MR to remove that needless reference to the fixed bug.
Comment #27
pfrenssenComment #29
berdirMerged, thanks. Will be verified through next major tests which are running on 8.5.
Comment #31
mably commentedThanks @berdir for the merge.