Skip to content

BC Break with 2.8.5, some services used to be public and are now private #18703

Closed
@DHager

Description

@DHager

Symptom

Upgrading Composer package symfony/symfony from 2.8.4 to 2.8.5 broke our application with the message:

[InvalidArgumentException]
The service "f0060f87044772964831885297651a58cbc94d84acb0738fee7c76412d631605_2" tagged "console.command" must be public.

Cause

The underlying issue is that our commands were not tagged public, ex:

        <service class="My\CompanyBundle\Command\EnumerateSomeAnnotations">
            <argument type="service" id="annotation_reader"/>
            <argument type="service" id="router"/>
            <tag name="console.command" />
        </service>

I've tracked the trigger down to the change made in #18491 with commit 0a469a4 which changed the logic for making anonymous services private by default.

Perhaps somebody could confirm that this is just old bug being fixed, rather than a new bug being introduced?

Solution (Workaround?)

Adding the attribute public="true" for our tagged commands seems to be the way forward.

Other potential symptoms

For the sake of people doing web-searches for error-messages, these other ones seem like they could pop up:

  • The service "%s" must be public as form type extensions are lazy-loaded.
  • The service "%s" must be public as form type guessers are lazy-loaded.
  • A synthetic service ("%s") must be public.
  • The service "%s" must be public as event listeners are lazy-loaded.
  • The service "%s" must be public as event subscribers are lazy-loaded.
  • The service "%s" must be public as fragment renderer are lazy-loaded.
  • The service "%s" tagged "console.command" must be public.
  • The service "%s" must be public as form types are lazy-loaded.

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