Too few arguments to function Drupal after update from 2.25 to 2.28

Created on 5 January 2021, about 4 years ago
Updated 16 December 2024, about 2 months ago

Problem/Motivation

Using Permission_by_term since about half a year on my Drupal 8.9.11. I updated to 2.27 but had to go back to 2.25 because I had problems with access protection to serveral nodes. Today I updated from 2.25 to 2.28. After the update I got a white screen with the message

The website encountered an unexpected error. Please try again later.
ArgumentCountError: Too few arguments to function Drupal\permissions_by_term\Service\AccessCheck::__construct()

Steps to reproduce

Calling any node of the website causes the error message:

The website encountered an unexpected error. Please try again later.
ArgumentCountError: Too few arguments to function Drupal\permissions_by_term\Service\AccessCheck::__construct(), 2 passed in «local_adress»/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 3 expected in Drupal\permissions_by_term\Service\AccessCheck->__construct() (line 42 of modules/contrib/permissions_by_term/src/Service/AccessCheck.php).

In the domains log-file there is almost the same message:

mod_fcgid: stderr: ArgumentCountError: Too few arguments to function Drupal\\permissions_by_term\\Service\\AccessCheck::__construct(), 2 passed in «local_adress»/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 3 expected in «a«local_adress»/web/modules/contrib/permissions_by_term/src/Service/AccessCheck.php on line 42 #0 «local_adress»/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\\permissions_by_term\\Service\\AccessCheck->__construct(Object(Drupal\\Core\\Database\\Driver\\mysql\\Connection), Object(Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher)), referer: «my_website»/user/login?current=/node/1

Proposed resolution

roll-back to version 2.25

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Postponed: needs info

Version

2.28

Component

Code

Created by

🇩🇪Germany wglombig

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.

  • 🇪🇸Spain qpro Spain

    Same error in Drupal v11 after:

    composer update "drupal/*" --with-all-dependencies (permissions_by_term went from 3.1.33 to 3.1.35)
    vendor/bin/drush updatedb
    vendor/bin/drush cache:rebuild

    And then

    ArgumentCountError: Too few arguments to function Drupal\permissions_by_term\Service\AccessStorage::__construct(), 7 passed in /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and at least 8 expected in /.../web/modules/contrib/permissions_by_term/src/Service/AccessStorage.php on line 34 #0 /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(261): Drupal\permissions_by_term\Service\AccessStorage->__construct()
    #1 /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService()
    #2 /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get()
    #3 /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(239): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
    #4 /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService()
    #5 /.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(289): Drupal\Component\DependencyInjection\Container->get()
    #6 /.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(253): Drush\Runtime\LegacyServiceInstantiator->resolveFromContainer()
    #7 [internal function]: Drush\Runtime\LegacyServiceInstantiator->resolveArgument()
    #8 /.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(223): array_map()
    #9 /.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(193): Drush\Runtime\LegacyServiceInstantiator->resolveArguments()
    #10 /.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(167): Drush\Runtime\LegacyServiceInstantiator->instantiateObject()
    #11 /.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(117): Drush\Runtime\LegacyServiceInstantiator->create()
    #12 /.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(54): Drush\Runtime\LegacyServiceInstantiator->instantiateServices()
    #13 /.../vendor/drush/drush/src/Boot/DrupalBoot8.php(242): Drush\Runtime\LegacyServiceInstantiator->loadServiceFiles()
    #14 /.../vendor/drush/drush/src/Boot/DrupalBoot8.php(218): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands()
    #15 /.../vendor/drush/drush/src/Boot/BootstrapManager.php(211): Drush\Boot\DrupalBoot8->bootstrapDrupalFull()
    #16 /.../vendor/drush/drush/src/Boot/BootstrapManager.php(397): Drush\Boot\BootstrapManager->doBootstrap()
    #17 /.../vendor/drush/drush/src/Application.php(219): Drush\Boot\BootstrapManager->bootstrapMax()
    #18 /.../vendor/drush/drush/src/Application.php(185): Drush\Application->bootstrapAndFind()
    #19 /.../vendor/symfony/console/Application.php(266): Drush\Application->find()
    #20 /.../vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
    #21 /.../vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
    #22 /.../vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
    #23 /.../vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run()
    #24 /.../vendor/bin/drush.php(117): include('...')
    #25 {main}
    ArgumentCountError: Too few arguments to function Drupal\permissions_by_term\Service\AccessStorage::__construct(), 7 passed in /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and at least 8 expected in Drupal\permissions_by_term\Service\AccessStorage->__construct() (line 34 of /.../web/modules/contrib/permissions_by_term/src/Service/AccessStorage.php).

  • 🇪🇸Spain qpro Spain

    Solved:

    1) First i did a module downgrade changing composer.json to require "drupal/permissions_by_term": "3.1.33"

    (and previous error disappear)

    2) The to solve WSOD caused by:

    "FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Error: "Class "Doctrine\Deprecations\Deprecation" not found" at /.../vendor/doctrine/lexer/src/Token.php line 104" while reading response header from upstream, client: 87.125.252.246, server: ..., request: "GET /user/login HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php8.3-fpm.sock:", host: "..."

    Run "composer dump-autoload -o"

    Note: Error seems not to be directly related to permissions_by_term but this https://www.drupal.org/project/drupal/issues/3492523#comment-15892853 🐛 Class "Doctrine\Deprecations\Deprecation" not found Active

  • 🇩🇪Germany Peter Majmesku 🇩🇪Düsseldorf

    This issue is outdated. Please use the latest version (3.1.35). https://www.drupal.org/project/permissions_by_term/releases/3.1.35

  • 🇪🇸Spain qpro Spain

    Tested in 3.1.35, (Drupal 10.4.1) same error:

    ArgumentCountError: Too few arguments to function Drupal\permissions_by_term\Service\AccessStorage::__construct(), 7 passed in /var/www/.../web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and at least 8 expected in /var/www/.../web/modules/contrib/permissions_by_term/src/Service/AccessStorage.php on line 34 #0 /var/www/.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(261): Drupal\permissions_by_term\Service\AccessStorage->__construct()
    #1 /var/www/.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService()
    #2 /var/www/.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get()
    #3 /var/www/.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(239): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
    #4 /var/www/.../web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\Component\DependencyInjection\Container->createService()
    #5 /var/www/.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(289): Drupal\Component\DependencyInjection\Container->get()
    #6 /var/www/.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(253): Drush\Runtime\LegacyServiceInstantiator->resolveFromContainer()
    #7 [internal function]: Drush\Runtime\LegacyServiceInstantiator->resolveArgument()
    #8 /var/www/.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(223): array_map()
    #9 /var/www/.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(193): Drush\Runtime\LegacyServiceInstantiator->resolveArguments()
    #10 /var/www/.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(167): Drush\Runtime\LegacyServiceInstantiator->instantiateObject()
    #11 /var/www/.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(117): Drush\Runtime\LegacyServiceInstantiator->create()
    #12 /var/www/.../vendor/drush/drush/src/Runtime/LegacyServiceInstantiator.php(54): Drush\Runtime\LegacyServiceInstantiator->instantiateServices()
    #13 /var/www/.../vendor/drush/drush/src/Boot/DrupalBoot8.php(242): Drush\Runtime\LegacyServiceInstantiator->loadServiceFiles()
    #14 /var/www/.../vendor/drush/drush/src/Boot/DrupalBoot8.php(218): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands()
    #15 /var/www/.../vendor/drush/drush/src/Boot/BootstrapManager.php(211): Drush\Boot\DrupalBoot8->bootstrapDrupalFull()
    #16 /var/www/.../vendor/drush/drush/src/Boot/BootstrapManager.php(397): Drush\Boot\BootstrapManager->doBootstrap()
    #17 /var/www/.../vendor/drush/drush/src/Application.php(219): Drush\Boot\BootstrapManager->bootstrapMax()
    #18 /var/www/.../vendor/drush/drush/src/Application.php(185): Drush\Application->bootstrapAndFind()
    #19 /var/www/.../vendor/symfony/console/Application.php(266): Drush\Application->find()
    #20 /var/www/.../vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
    #21 /var/www/.../vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
    #22 /var/www/.../vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
    #23 /var/www/.../vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run()
    #24 /var/www/.../vendor/bin/drush.php(117): include('...')
    #25 {main}
    ArgumentCountError: Too few arguments to function Drupal\permissions_by_term\Service\AccessStorage::__construct(), 7 passed in /var/www/.../web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and at least 8 expected in Drupal\permissions_by_term\Service\AccessStorage->__construct() (line 34 of /var/www/.../web/modules/contrib/permissions_by_term/src/Service/AccessStorage.php).

    Solved with composer require "drupal/permissions_by_term:3.1.33" but this time it was not necessary run "composer dump-autoload -o"

  • 🇩🇪Germany Peter Majmesku 🇩🇪Düsseldorf

    I cannot reproduce that. Installed a fresh Drupal site and I do not see this error:

    ➜  drupal-10-pbt d drush en permissions_by_term -y
    >  [notice] Message: The content access permissions have been rebuilt.
    >
     [success] Module permissions_by_term has been installed. (Help - Permissions - Configure)
    ➜  drupal-10-pbt d drush cr
     [success] Cache rebuild complete.
    ➜  drupal-10-pbt d launch
    ➜  drupal-10-pbt d composer show | grep drupal/core
    drupal/core                              10.4.1  Drupal is an open source content management platform powering millions of websi...
    drupal/core-composer-scaffold            10.4.1  A flexible Composer project scaffold builder.
    drupal/core-project-message              10.4.1  Adds a message after Composer installation.
    drupal/core-recommended                  10.4.1  Core and its dependencies with known-compatible minor versions. Require this pr...
    ➜  drupal-10-pbt   
    

    You might check your individual Drupal website. Maybe this error is tight to individual implementations. If you are able to break down the error, then you could a provide a step-by-step instruction to reproduce the error in a basic Drupal 10 site. There is no error visible after a ordinary module installation.

Production build 0.71.5 2024