8000 [DependencyInjection] Fix getArgument() for replaced definition arguments by jmikola · Pull Request #2502 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection] Fix getArgument() for replaced definition arguments #2502

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

Merged
merged 2 commits into from
Oct 28, 2011
Merged

[DependencyInjection] Fix getArgument() for replaced definition arguments #2502

merged 2 commits into from
Oct 28, 2011

Conversation

jmikola
Copy link
Contributor
@jmikola jmikola commented Oct 27, 2011

I was implementing something that worked with DefinitionDecorators before the container was compiled and ran into some missing functionality. While I was tinkering, I also added some additional tests for exceptions in both Definition and DefinitionDecorator.

…acements

While Definition::getArgument() could be used to fetch replaced values, it relied upon bad comparison logic (e.g. "index_1" > 1). Additionally, storing original arguments and replacements in the same array makes Definition::getArguments()'s bounds check unreliable. A single argument and its replacement would count twice, allowing getArgument(2) to pass the bounds check and result in an array index error.

With this new method, fetching of replacement arguments is more straightforward and bounds checking functions as it should.
fabpot added a commit that referenced this pull request Oct 28, 2011
Commits
-------

80f0b98 [DependencyInjection] Fix DefinitionDecorator::getArgument() for replacements
4bbb685 [DependencyInjection] Test Definition and DefinitionDecorator exceptions

Discussion
----------

[DependencyInjection] Fix getArgument() for replaced definition arguments

I was implementing something that worked with DefinitionDecorators before the container was compiled and ran into some missing functionality. While I was tinkering, I also added some additional tests for exceptions in both Definition and DefinitionDecorator.
@fabpot fabpot merged commit 80f0b98 into symfony:2.0 Oct 28, 2011
jmikola added a commit to Exercise/JmikolaJsAssetsHelperBundle that referenced this pull request Nov 3, 2011
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.

2 participants
0