Too few arguments error

Created on 20 September 2024, 4 months ago
Updated 21 September 2024, 4 months ago

Drupal 10.3.5, php 8.3.11, AlmaLinux 9.4 Mariadb

Upgrade to latest release beta 2 throws

ArgumentCountError: Too few arguments to function Drupal\domain\DomainElementManager::__construct(), 1 passed in /var/www/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and exactly 2 expected in Drupal\domain\DomainElementManager->__construct() (line 58 of modules/domain/domain/src/DomainElementManager.php).
Drupal\Component\DependencyInjection\Container->createService(Array, 'domain.element_manager') (Line: 179)
Drupal\Component\DependencyInjection\Container->get('domain.element_manager') (Line: 197)
Drupal::service('domain.element_manager') (Line: 275)
domain_access_form_node_form_alter(Array, Object, 'node_page_edit_form') (Line: 552)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_page_edit_form') (Line: 88)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->alter(Array, Array, Object, 'node_page_edit_form') (Line: 834)
Drupal\Core\Form\FormBuilder->prepareForm('node_page_edit_form', Array, Object) (Line: 285)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)

More

I had to put beta1 back on

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bobburns

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

Comments & Activities

  • Issue created by @bobburns
  • πŸ‡¬πŸ‡§United Kingdom aaron.ferris

    Hmm, thats very odd - looking at the stack trace this is happening in a node edit form?

    The service definition has 2 arguments, the DomainElementManager construct has the 2. Not sure why only one would be being injected for you. Ive stepped through the domain_access_form_node_form_alter and the service appears to be called properly.

      // Add the options hidden from the user silently to the form.
      $manager = \Drupal::service('domain.element_manager');
      $form = $manager->setFormOptions($form, $form_state, DomainAccessManagerInterface::DOMAIN_ACCESS_FIELD);

    I tried
    1. Latest version of this module
    2. Drupal 10.3.5
    3. Enable Domain
    4. Enable Domain Access
    5. Add a node
    6, Edit the node

    Complete reproduction steps please?

  • πŸ‡ΊπŸ‡ΈUnited States bobburns

    First the auto update through Drupal did not work so I moved the module of beta1 and expanded beta2 download as a TAR gz in its place

    Then I tried to edit a node with ckeditor from the content area - that threw the rrror

    I moved the beta1 module back in and changed the info files to beta2 so the update notification would not come back

    When I swapped the beta2 back in and tried to edit the node it threw the error again

    This through an Android Chrome browser - it should be noted this browser when editing throws double words which the ckeditor people could not figure out

    I fired up a terminal on another computer and did a "drush cache:rebuild" and went to the Android Chrome browser and recycled it and ckeditor in edit mode came up after a long wait - about two minutes

    It appears to be working after the cache rebuild

    Here is the full trace error the second time

    ArgumentCountError: Too few arguments to function Drupal\domain\DomainElementManager::__construct(), 1 passed in /var/www/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and exactly 2 expected in Drupal\domain\DomainElementManager->__construct() (line 58 of modules/domain/domain/src/DomainElementManager.php).
    Drupal\Component\DependencyInjection\Container->createService(Array, 'domain.element_manager') (Line: 179)
    Drupal\Component\DependencyInjection\Container->get('domain.element_manager') (Line: 197)
    Drupal::service('domain.element_manager') (Line: 275)
    domain_access_form_node_form_alter(Array, Object, 'node_page_edit_form') (Line: 552)
    Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_page_edit_form') (Line: 88)
    Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->alter(Array, Array, Object, 'node_page_edit_form') (Line: 834)
    Drupal\Core\Form\FormBuilder->prepareForm('node_page_edit_form', Array, Object) (Line: 285)
    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: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
    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: 53)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->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: 52)
    Drupal\crawler_rate_limit\CrawlerRateLimitMiddleware->handle(Object, 1, 1) (Line: 57)
    Drupal\advban\AdvbanMiddleware->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: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Production build 0.71.5 2024