8000 XML service arguments with attribute id="0" are treated as not having it at all. · Issue #29854 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

XML service arguments with attribute id="0" are treated as not having it at all. #29854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
szymach opened this issue Jan 11, 2019 · 0 comments
Closed

Comments

@szymach
Copy link
szymach commented Jan 11, 2019

Symfony version(s) affected: checked on 3.4.21

Description
Hello,

In an older version of a library I use, there as a compiler pass that uses annotations to automatically tag services whose classes have it. It defines services as having the actual class, but the id attribute is an incremented integer index starting from 0. This causes the XmlFileLoader to throw an exception due to variable casting.

I know this method of creating services is obsolete, but I am wondering whether not allowing a service with id 0 (which here is anonymous and only used in a collection parameter of another service) should be prohibited. Perhaps the linked condition should strictly check for null and empty string instead of casting it to a boolean.

None of this is a big issue to me, just thought I would report it.

Additional context

I run into this issue only while performing a debug:container command, the application itself runs without an exception for some reason.

@fabpot fabpot closed this as completed Jan 15, 2019
fabpot added a commit that referenced this issue Jan 15, 2019
…entifier (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[DependencyInjection] the string "0" is a valid service identifier

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29854
| License       | MIT
| Doc PR        |

Commits
-------

caca373 the string "0" is a valid service identifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0