Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[6.2] Reference to abstract service with invalidBehavior:IGNORE_ON_INVALID_REFERENCE still produces error #48411

Copy link
Copy link
Closed
@ruudk

Description

@ruudk
Issue body actions

Symfony version(s) affected

6.2.0

Description

After upgrading to 6.2.0 I noticed that some of my service locators broke.

How to reproduce

I was adding some typed arguments of a method (in a compiler pass) to an array like this:

foreach {
  // some logic
  $services[$class] = new Reference(
      $class
      ContainerInterface::IGNORE_ON_INVALID_REFERENCE,
  );
}

// Create service locator
ServiceLocatorTagPass::register($container, $services);

I was using ContainerInterface::IGNORE_ON_INVALID_REFERENCE to automatically filter out invalid services. This used to work fine in 6.1.

But in 6.2.0 I get this error:

In CheckReferenceValidityPass.php line 37:

  The definition ".service_locator.ZCXM_ST" has a reference to an abstract definition "App\Entity\SomeEntity". Abstract definitions cannot be the target of references.

Possible Solution

I think CheckReferenceValidityPass should not report an error when the Reference has ContainerInterface::IGNORE_ON_INVALID_REFERENCE.

Additional Context

It's related to:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.