Skip to content

DI BC break for integer service ids since 3.4.27 & 4.2.9, >4.3 #34296

Closed
@bburnichon

Description

@bburnichon

Symfony version(s) affected: since 3.4.27

Description

If using a ServiceLocator with ids that looks like integers, given offset is ignored.

How to reproduce

service:
    my_service_locator:
        class: Symfony\Component\DependencyInjection\ServiceLocator
        public: false
        tags: ['container.service_locator']
        arguments:
            -
                '16': '@my_service1'
                '32': '@my_service2'

In my usecase, I want a different service based on a computation over data. (a string length). It was working fine with version 3.4.27 but doing the upgrade, system is now broken without changing the dependency injection configuration

Possible Solution

Issue occurs since 7146b95#diff-af68f8fbd009fd8de36403795ea0cf0aR52

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions