Token module issues

Events happening in the community are now at Drupal community events on www.drupal.org.

Upgrade to Drupal 11.3.2. Another Unexpected error encountered

January 11, 2026 at 1:46pm
Problem/Motivation

Problem with another web site after upgrading it to 11.3.2

Other upgrades applied at te same time :
mimemail
token
solo utilities
solo theme

I also have applied the patch in ThemeRegistry.php
+#3564510: TypeError: Drupal\Core\Utility\ThemeRegistry::getGlobalPreprocess(): Return value must be of type array

When I tried to run update.php I got the "unexpected error" message.
Now when I try to access to the site, I also get the "unexpected error" message.

This is what is reported in the web server logs.

[Sun Jan 11 14:31:54 2026] [X-OVHRequest-Id: 8dacd6a65072552bff3f2a8c83f6b6c0] [error] [client 2a01:cb10:873:e700:f13a:3e7a:afda:de34:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\token\\Hook\\TokenHooks::__construct(), 0 passed in /home/tribupv/www/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php on line 39 and exactly 3 expected" at /home/tribupv/www/modules/token/src/Hook/TokenHooks.php line 22
[Sun Jan 11 14:32:10 2026] [X-OVHRequest-Id: 4e9f357c081606bed8f2b04d86c9165c] [error] [client 2a01:cb10:873:e700:f13a:3e7a:afda:de34:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\token\\Hook\\TokenHooks::__construct(), 0 passed in /home/tribupv/www/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php on line 39 and exactly 3 expected" at /home/tribupv/www/modules/token/src/Hook/TokenHooks.php line 22
[Sun Jan 11 14:32:30 2026] [X-OVHRequest-Id: 16772be0668b5f8c5b710fb634d10bdd] [error] [client 2a01:cb10:873:e700:f13a:3e7a:afda:de34:0] [host www.tribupierre.net] AH10131: FastCGI: server "/homez.2186/tribupv/www/index.php" stderr: PHP message: Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\token\\Hook\\TokenHooks::__construct(), 0 passed in /home/tribupv/www/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php on line 39 and exactly 3 expected" at /home/tribupv/www/modules/token/src/Hook/TokenHooks.php line 22

Thanks for your help.

Steps to reproduce Proposed resolution Remaining tasks User interface changes Introduced terminology API changes Data model changes Release notes snippet
Categories: issue queues

You have requested a non-existent service "Drupal\\token\\Hook\\TokenHooks"

January 9, 2026 at 6:06pm
Problem/Motivation

After update from 1.16 to 1.17, broke the site
Debuging the message in log server, appear a message:
Got error 'PHP message: Uncaught PHP Exception Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException: "You have requested a non-existent service "Drupal\\token\\Hook\\TokenHooks".

Steps to reproduce

Drupal 10.5.7
Token 1.16

Proposed resolution

Revert the update to 1.16

Remaining tasks User interface changes API changes Data model changes
Categories: issue queues

Deprecated function: Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead

January 6, 2026 at 3:51pm
Problem/Motivation

In the `token.tokens.inc` file at line 806 (see also https://git.drupalcode.org/project/token/-/blob/8.x-1.16/token.tokens.in...) the last `case` statement in the `switch` is being terminated using a semicolon (;) instead of a colon (:). Besides the fact that this was probably a typo, terminating `case` statements with a semicolon has been deprecated in PHP 8.5.

Proposed resolution

The semicolon in https://git.drupalcode.org/project/token/-/blob/8.x-1.16/token.tokens.in... should be replaced with a colon to ensure compatibility with PHP 8.5 and later PHP versions.

Categories: issue queues

node:menu-link doesn't correctly update when "Provide a menu link" is unchecked

December 19, 2025 at 9:13am
Problem/Motivation

When a node is saved with "Provide a menu link" checked and filled in the token is generated based on the values in the form. When a node is saved outside the form it is generated based on menu_ui_get_menu_link_defaults via _token_menu_link_best_match which gets the "Best" menu link for the node.

If a menu item is removed by unchecking "Provide a menu link", token falls back to menu_ui_get_menu_link_defaults and finds the original menu link, which is removed after save leading to an incorrect token replacement.

Steps to reproduce
  1. Set a pathauto pattern to /[node:menu-link:menu:machine-name]/[node:title]
  2. Save a node with "Provide a menu link" checked
  3. Node path should be prefixed with the menu name
  4. Edit the node and uncheck "Provide a menu link"
  5. Node path will incorrectly still be prefixed with the menu name
  6. Edit the node and save without changes
  7. Node path will be corrected to remove the menu name
Proposed resolution

Use $node->menu to filter the results from menu_ui_get_menu_link_defaults

$node->menu has the values of the form. If it was just disabled the previous id will still be there for reading, but I'm not sure if this is a documented API or undefined behavior.

Categories: issue queues