Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Container::camelize also takes backslashes into consideration #9610

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
wants to merge 1 commit into from

Conversation

ondrejmirtes
Copy link
Contributor

I complained about unreported and unnoticed BC break.

Service names in our DI container contain backslashes and that pull request rendered newer versions of Symfony unusable for us.

This commit fixes this - it normalizes backslashes in service names into underscores.

fabpot added a commit that referenced this pull request Nov 25, 2013
…on (ondrejmirtes)

This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closes #9610).

Discussion
----------

Container::camelize also takes backslashes into consideration

I [complained](#8494) about unreported and unnoticed BC break.

Service names in our DI container contain backslashes and that pull request rendered newer versions of Symfony unusable for us.

This commit fixes this - it normalizes backslashes in service names into underscores.

Commits
-------

0f9bb0a Container::camelize also takes backslashes into consideration
@fabpot fabpot closed this Nov 25, 2013
@ondrejmirtes ondrejmirtes deleted the camelize-backslash branch November 25, 2013 15:17
@stof
Copy link
Member

stof commented Nov 25, 2013

I see an issue here: if you have both foo.bar and foo\bar in the same container, the generated name will be the same and you will have a fatal error in the dumped container

@GromNaN
Copy link
Member

GromNaN commented Nov 25, 2013

If you declare the service foo\bar, you cannot call it with this name. The container looks for a method named getfoo\barService.

@stof
Copy link
Member

stof commented Nov 25, 2013

@GromNaN This merged PR is precisely about allowing it, generating getFoo_BarService instead of getFoo\barService.

but the issue is that getFoo_BarService was already used for foo.bar

@stof
Copy link
Member

stof commented Nov 25, 2013

hmm, looks like the logic has been changed only in 1 place and not in the other one...

fabpot added a commit that referenced this pull request Dec 21, 2013
…ice ids. (jakzal)

This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection] Fixed support for backslashes in service ids.

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

This change is needed for consistency with `camelize()` which is used in [`ProxyDumper`](https://github.com/symfony/symfony/blob/2.3/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php#L69) and [`PhpDumper`](https://github.com/symfony/DependencyInjection/blob/2.3/Dumper/PhpDumper.php#L1275).

Either this PR needs to be merged for consistency or #9610 rolled back (if we don't want to support backslashes in service ids).

Anyone could tell me why we're not using the `camelize()` method internally in the `Container`?

Commits
-------

c6f210b [DependencyInjection] Fixed support for backslashes in service ids.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants