-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Milestone
Description
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | yes |
| BC Break report? | no |
| Symfony version | 3.x |
Given
services:
AppBundle\Foo: [a, b]
foo:
parent: AppBundle\Foo
arguments: { '$b': b_custom }I get
ContextErrorException in ResolveDefinitionTemplatesPass.php line 173:
Notice: Undefined variable: index
I checked it out and tried a quick patch
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php
index 9cc2250..b3856b2 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php
@@ -166,7 +166,9 @@ class ResolveDefinitionTemplatesPass extends AbstractRecursivePass
if (0 === strpos($k, 'index_')) {
$index = (int) substr($k, strlen('index_'));
- } elseif (0 !== strpos($k, '$')) {
+ } elseif (0 === strpos($k, '$')) {
+ $index = $k;
+ } else {
throw new RuntimeException(sprintf('Invalid argument key "%s" found.', $k));
}No luck
OutOfBoundsException in Definition.php line 214:
Service "foo": The argument "$b" doesn't exist.
Kind of a feature request, but certainly an expected one if you ask me.
chalasr