Argument #3 ($time) must be of type Drupal\Component\Datetime\Time

Created on 8 April 2022, over 2 years ago
Updated 25 March 2024, 9 months ago

Problem/Motivation

TypeError: Drupal\advban\AdvbanIpManager::__construct(): Argument #3 ($time) must be of type Drupal\Component\Datetime\Time, Drupal\Core\Datetime\DateFormatter given, called in /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 in Drupal\advban\AdvbanIpManager->__construct() (line 47 of /home/mysite/public_html/modules/contrib/advban/src/AdvbanIpManager.php)
#0 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(262): Drupal\advban\AdvbanIpManager->__construct()
#1 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#2 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(437): Drupal\Component\DependencyInjection\Container->get()
#3 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(240): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#4 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#5 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(437): Drupal\Component\DependencyInjection\Container->get()
#6 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(240): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#7 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#8 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(437): Drupal\Component\DependencyInjection\Container->get()
#9 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(240): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#10 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#11 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(437): Drupal\Component\DependencyInjection\Container->get()
#12 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(240): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#13 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#14 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(437): Drupal\Component\DependencyInjection\Container->get()
#15 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(240): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#16 /home/mysite/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(176): Drupal\Component\DependencyInjection\Container->createService()
#17 /home/mysite/public_html/core/lib/Drupal/Core/DrupalKernel.php(1361): Drupal\Component\DependencyInjection\Container->get()
#18 /home/mysite/public_html/core/lib/Drupal/Core/DrupalKernel.php(708): Drupal\Core\DrupalKernel->getHttpKernel()
#19 /home/mysite/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
#20 {main}

Steps to reproduce

1. Navigate to the: admin/config/people/advban
2. Set an IP and/or IP end
3. Make sure that the "IP ban expiry duration" option is set to "Never"
4. Click "Add"

Proposed resolution

Adjust the expiryDurations() method from src/AdvbanIpManager.php because the root cause is there.

Remaining tasks

1. Write a fix for it and prepare the fork and merge request for a review.
2. Provide a patch (that could be applied before the fix will be released)

User interface changes

No fatal error should display when adding a new IP ban.

API changes

No.

Data model changes

No.

πŸ› Bug report
Status

Closed: cannot reproduce

Version

1.0

Component

Code

Created by

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.

Production build 0.71.5 2024