Problem/Motivation

While investigating another issue I spotted this code in \Drupal\Component\DependencyInjection\Container::reset():

    if (!empty($this->scopedServices)) {
      throw new LogicException('Resetting the container is not allowed when a scope is active.');
    }

Scoped services were deprecated in Symfony 2.8 and removed in Symfony 3: https://symfony.com/blog/new-in-symfony-2-8-deprecating-scopes-and-intro...

We removed most mentions of scoped services in #2712647: Update Symfony components to ~3.2 but this one was missed.

Steps to reproduce

Proposed resolution

Remove these lines.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3325857-2.patch669 byteslongwave

Comments

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review
Parent issue: » #3228629: [meta] Bring dependency injection more in line with upstream Symfony component
StatusFileSize
new669 bytes
andypost’s picture

Status: Needs review » Reviewed & tested by the community

bot should be green, nice clean-up

  • xjm committed 3d6efbfd on 10.1.x
    Issue #3325857 by longwave: Remove dead code from Container::reset()
    

  • xjm committed 841b2163 on 10.0.x
    Issue #3325857 by longwave: Remove dead code from Container::reset()
    
    (...

  • xjm committed dd518fab on 9.5.x
    Issue #3325857 by longwave: Remove dead code from Container::reset()
    
    (...
xjm’s picture

Nice find! I confirmed that this is the only remaining reference:

[ayrton:maintainer | Sun 17:55:15] $ grep -ri "scopedservices" *
core/lib/Drupal/Component/DependencyInjection/Container.php:    if (!empty($this->scopedServices)) {

Committed to 10.1.x, and cherry-picked to 10.0.x and 9.5.x. Thanks!

xjm’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.