Drupal 10 Compatibility

Created on 12 May 2023, about 1 year ago
Updated 2 April 2024, 3 months ago

Problem/Motivation

Menu Token 9.1.0-alpha1.

2 warnings found.

web/modules/custom/menu_token/src/EventSubscriber/MenuTokenSubscriber.php:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ STATUS โ”‚ LINE โ”‚ MESSAGE โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Check โ”‚ 39 โ”‚ Parameter $event of method โ”‚
โ”‚ manually โ”‚ โ”‚ Drupal\menu_token\EventSubscriber\MenuTokenSubscriber::onCon โ”‚
โ”‚ โ”‚ โ”‚ troller() has typehint with deprecated class โ”‚
โ”‚ โ”‚ โ”‚ Symfony\Component\HttpKernel\Event\FilterControllerEvent: โ”‚
โ”‚ โ”‚ โ”‚ since Symfony 4.3, use ControllerEvent instead โ”‚
โ”‚ โ”‚ โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

web/modules/custom/menu_token/menu_token.info.yml:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ STATUS โ”‚ LINE โ”‚ MESSAGE โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Check โ”‚ 0 โ”‚ Value of core_version_requirement: ^8 || ^9 is not โ”‚
โ”‚ manually โ”‚ โ”‚ compatible with the next major version of Drupal core. See โ”‚
โ”‚ โ”‚ โ”‚ https://drupal.org/node/3070687. โ”‚
โ”‚ โ”‚ โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“Œ Task
Status

Needs work

Version

9.1

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia yogeshsevak

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

Comments & Activities

Not all content is available!

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

  • Issue created by @yogeshsevak
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia yogeshsevak

    Providing patch with fixes. Please review.

  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

    Hi

    The patch is giving error while appling can you check once

    git apply -v menu-token-d10-compqtibility-3359873-2.patch
    Checking patch menu_token.info.yml...
    error: while searching for:
    name: Menu Token
    type: module
    description: Menu Token module provides tokens, that can be used in title or in path of menu items (links).
    core_version_requirement: ^8 || ^9
    package: Custom
    configure: menu_token.available_entities_configuration_form
    dependencies:

    error: patch failed: menu_token.info.yml:1
    error: menu_token.info.yml: patch does not apply
    Checking patch src/EventSubscriber/MenuTokenSubscriber.php...
    error: src/EventSubscriber/MenuTokenSubscriber.php: No such file or directory

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia yogeshsevak

    Patch is successfully applied for version 9.1.0-alpha1.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joshf

    #2 applied cleanly for me and doesn't seem to cause any problems. Thanks for the patch!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States fehin

    I have Drupal 10 installed and I can't figure out how to use this patch. I'm unable to install the module with Composer because it's not compatible with Drupal 10 so when I tried to use Composer to apply the patch by adding the patch under Extra in the composer.json file, it didn't work. How do I apply this patch using Drupal 10 and Composer or any other method?

  • I experienced the same issue as fehin. Earlier versions of Drupal 10 would allow installation of this module, but as of 10.1.5, it canโ€™t even be installed. Can a Drupal 10 version of this module be published soon? Drupal 9 is EOL at the end of November 2023. There are many of us trying diligently to migrate to Drupal 10, but important modules are not yet ready for Drupal 10. This module is important for site navigation and integrates with the path wildcard and contextual filter capability of Views.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada optasy

    I tested this on my D10 instance and works as expected, I used the token [current-user:uid] for a link in the main menu and I got the expected link.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joshf

    @fehin @cinglefield1 you'll need to apply the patch attached to this issue in order for the module to work on Drupal 10. If you're using composer, I suggest composer patches as a way to have composer automatically apply patches for you.

  • Status changed to RTBC 8 months ago
  • ๐Ÿ‡น๐Ÿ‡ทTurkey kburakozdemir ฤฐstanbul

    Patch #2 works for me. Thanks.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada plousia

    Patch not working for me. I get:

    Applying patches for drupal/menu_token
    https://www.drupal.org/files/issues/2023-05-12/menu-token-d10-compqtibil... โ†’ (D10 compatibility)
    Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2023-05-12/menu-token-d10-compqtibil... โ†’

    In PluginManager.php(277) : eval()'d code line 331:

    Cannot apply patch D10 compatibility ( https://www.drupal.org/files/issues/2023-05-12/menu-token-d10-compqtibil... โ†’
    359873-2.patch)!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States goose2000

    Hi, just installed from composer on my site (D 10.1.6). PHP 8.1
    When I enabled the module I saw this error :

    Error message
    Close
    Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\menu_token\Service\MenuTokenContextManager->__construct() (line 34 of modules\contrib\menu_token\src\Service\MenuTokenContextManager.php).
    Drupal\menu_token\Service\MenuTokenContextManager->__construct(Object, Object, Object, Object, Object) (Line: 259)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'menu_token.context_manager') (Line: 177)
    Drupal\Component\DependencyInjection\Container->get('menu_token.context_manager') (Line: 197)
    Drupal::service('menu_token.context_manager') (Line: 374)
    menu_token_menu_links_discovered_alter(Array, NULL, NULL) (Line: 545)
    Drupal\Core\Extension\ModuleHandler->alter('menu_links_discovered', Array) (Line: 127)
    Drupal\Core\Menu\MenuLinkManager->getDefinitions() (Line: 150)
    Drupal\Core\Menu\MenuLinkManager->rebuild() (Line: 90)
    Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->menuLinksRebuild() (Line: 78)
    Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->onRouterRebuild(Object, 'routing.route_finished', Object)
    call_user_func(Array, Object, 'routing.route_finished', Object) (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'routing.route_finished') (Line: 197)
    Drupal\Core\Routing\RouteBuilder->rebuild() (Line: 83)
    Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild() (Line: 377)
    Drupal\Core\Extension\ModuleInstaller->install(Array, 1) (Line: 83)
    Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array) (Line: 502)
    Drupal\system\Form\ModulesListForm->submitForm(Array, Object)
    call_user_func_array(Array, Array) (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
    Drupal\Core\Form\FormBuilder->processForm('system_modules', Array, Object) (Line: 325)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
    Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  • @joshf, appreciate you getting back to me, but the patch in #2 is not applying for Drupal 10.1.6, PHP 8.1.25, menu_token 9.1.0-alpha1 or 9.1.x-dev. I applied it manually to menu_token 9.1.0-alpha1, as the 9.1.x-dev folder structure doesnโ€™t even support the patch. I am trying to use the token [node:nid] in my menu path, and the result when navigating to that path is the [node:nid] is not expanded properly ([node%3Anid]), and I receive the WSOD. The error in the access log indicates that %5Bnode%3Anid%5D is attempting to be retrieved. Appreciate if someone would work on the D10 version of this module, making sure that the token [node:nid] can be interpreted in the menu path. Thank you.

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joshf

    @cinglefield1 the patch won't install via composer on Drupal 10 unless you use something like drupal-lenient โ†’ . The reason for this is that composer checks the module's composer.json for compatibility before applying any patches. Since the unpatched module doesn't have D10 compatibility listed, it rejects the module entirely.

    I can reproduce the error you're getting with [node:nid]. It's not a regression caused by this patch but it looks like the patch may not fix all PHP8.1 compatibility problems. Back to Needs Work.

  • @josh - thank you so much! Both for the explanation of why the patch didn't install, and for being able to replicate this error. I will keep watching for the fix, as my navigational menus in the D7 site are heavily reliant on [node:nid] being translated in the path. thank you again, Caroline

  • ๐Ÿ‡ธ๐Ÿ‡ชSweden edward.peters

    I patched the module manually and moved the module to a custom folder, to keep it working for me in Drupal 10. But a D10-compatible release will be highly appreciated!

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand djroshi

    OK so I've been looking into this as I need this for a client upgrade from D7.

    First things first: this issue is tagged against 9.1.0-alpha1 (released 2 December 2021). I mention this because the dev branch (9.1.x-dev, last updated 21 Feb 2023) is WAY ahead of the alpha version, and already reports D10 compatibility.

    I'm fairly new to the party so I can't tell why an alpha2 release hasn't eventuated in the last 2 years, but just comparing alpha1 with what's currently on the dev branch...

    There was a complete rewrite of the storage mechanism as a result of ( https://www.drupal.org/project/menu_token/issues/3162925 โ†’ ) which completely removes the ConfigEntity (LinkConfigurationStorage) and now stores menu_token config directly on the \Drupal\menu_link_content\Entity\MenuLinkContent entity. I mention this because there doesn't appear to be a hook_update_N() which converts from the old storage to the new storage (and therefore no upgrade path for existing users).

    As I see it, the way forward will be to fix any major bugs on the dev branch, provide an update hook, and tag an alpha2 release.

  • ๐Ÿ‡ธ๐Ÿ‡ชSweden edward.peters

    Thank you very much @djroshi for this evaluation of where things are at.

    I have been using the patched version of the Alpha release for a few weeks, deployed as a custom module, and it was working ok. But lately there have been some problems, principally:

    (1) the code started insterting UID 1 for all logged in users as the [current-user:uid]

    (2) when configuring menu items, a fatal error is thrown which seems to be related to this module:
    Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in Drupal\Core\Entity\Query\Sql\Query->prepare() (line 141 of /Users/edward/Sites/sclukd8/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

    So I am rather stuck. What would it take/cost to get this module fully ready for D10?

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom andrew.farquharson

    I am changing the version from 9.1.0-alpha1 to 9.1.x-dev because it seems that 9.1.0-alpha1 should remain compatible with D8 and D9. Whereas there is substantial work required in addition to D10 compatibility fixes to get version 9.1.x-dev in a state to cut a 9.1.0-alpha2 version from it.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand djroshi

    I got this working by installing the dev branch and patching https://www.drupal.org/project/menu_token/issues/3404802 ๐Ÿ› TypeError: unserialize() upon install (Drupal 10, PHP 8.1) Needs review

    You can do this by:
    1. composer require 'drupal/menu_token:9.1.x-dev@dev'
    2. composer require 'cweagans/composer-patches'
    3. add the following or similar to composer.json

    "patches": {
      "drupal/menu_token": {
        "TypeError: unserialize() upon install": "https://www.drupal.org/files/issues/2023-11-29/3404802-typeerror-unserialize-9.1.x.patch"
      }
    }
    

    If you are already using menu token I would suggest removing existing menu_token menu items and uninstalling as the schema has changed and there is no update hook.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom andrew.farquharson

    @djroshi This is not ideal. #23 Issue 3404802 has status 'Needs review'. That issue should be marked fixed and then closed before it is applied to other issues IMO. I will try to review it shortly. If others could do the same before trying to resolve this issue..

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand djroshi

    Thanks Andrew. I appreciate that. I'm a little confused as to why user chetan11 didn't review my patch and instead committed their own code to the issue fork and marked the issue "needs review". But then I haven't been active in the community for wee while so maybe things have changed.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom andrew.farquharson

    Hi @djroshi, As i understand it others can review your patch and the merge request of chetan11. They can apply their own patch or make commits to the issue fork/ branch. They can create their own branch also. Others can then review/ test all patches and branches.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance alex.amtr

    As I understand this component is very useful but is a piece of shit.
    It is not acceptable to have a component not available for at least D10.
    Is there anyone who would like to develop a real component ?

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada danrod

    Patch #2 applied ok on my side, still need to do some extra testing to see if the updated module actually works for D10, if not, we might need to consider rewriting this in a new custom module.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Vishal Choudhary Dharmshala

    Comment #1 is working for me.
    I have used this 3359873-drupal-10-compatibility branch to use in drupal 10 instance its working fine with composer
    To add this in composer with the URL https://git.drupalcode.org/issue/menu_token-3359873 and its working on drupal 10 Fine
    Thanks for the contribution

  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Vishal Choudhary Dharmshala
  • @vishal-choudhary โ€“ Yes, I am able to install menu_token:9.1.x-dev successfully with composer. But it is still not working! My configuration is Drupal 10.2.4, PHP 8.1.27.
    1. I am trying to insert the [node:nid] token in the path, and am able to configure it in the menu. (image1.png)
    2. However, there is no indication that this menu โ€œUses Tokensโ€, as there is in the D7 working version. (image2.png)
    3. When the user navigates to the menu link, the token is not interpreted โ€“ instead, the path looks like this:
    node/[node%3Anid]/profile
    4. I can no longer find errors in the PHP logs or the Drupal logs regarding this module. Also, I tried another token related to user, [current-user:uid], and that doesnโ€™t work either.
    This module helped me navigate all of my menus in D7. Can someone suggest an alternative that will do the same in D10?

  • Status changed to Needs work 3 months ago
Production build 0.69.0 2024