-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Fixed variadic method parameter in autowired classes #21372
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…asses ReflectionException: Internal error: Failed to retrieve the default value in /www/raspberry/vendor/symfony/dependency-injection/Compiler/AutowirePass.php:437
…asses PHP5.5 support...
dunglas
reviewed
Jan 22, 2017
public function testProcessVariadic() | ||
{ | ||
$container = new ContainerBuilder(); | ||
$container->register('foo', __NAMESPACE__.'\Foo'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use Foo::class
here too
👍 |
…asses change from code review
Thank you @brainexe. |
fabpot
added a commit
that referenced
this pull request
Jan 22, 2017
…utowired classes (brainexe) This PR was squashed before being merged into the 3.1 branch (closes #21372). Discussion ---------- [DependencyInjection] Fixed variadic method parameter in autowired classes | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | -- | License | MIT Autowiring classes containing methods with variadic method parameter throws a ReflectionException in compile process: ``` PHP Fatal error: Uncaught ReflectionException: Internal error: Failed to retrieve the default value in /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php:437 Stack trace: #0 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(437): ReflectionParameter->getDefaultValue() #1 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(80): Symfony\Component\DependencyInjection\Compiler\AutowirePass::getResourceMetadataForMethod(Object(ReflectionMethod)) #2 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(105): Symfony\Component\DependencyInjection\Compiler\AutowirePass::createResourceForClass(Object(ReflectionClass)) #3 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(48): Symfony\Component\DependencyInjection\Compiler\AutowirePass->completeDefinition('__controller.Sw...', Object(Symfony\Component\DependencyInjection\Definition), Array) #4 /.../vendor/symfony/dependency-injection/Compiler/Compiler in /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php on line 437 ``` **Example:** ``` <?php class FooVariadic { public function bar(...$arguments) { } } $method = new ReflectionMethod(FooVariadic::class, 'bar'); $parameter = $method->getParameters()[0]; $parameter->getDefaultValue(); // -> ReflectionException: Internal error: Failed to retrieve the default value in ... ``` Commits ------- a7f63de [DependencyInjection] Fixed variadic method parameter in autowired classes
fabpot
added a commit
that referenced
this pull request
Jan 23, 2017
…alidation secti… (davewwww) This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] add "mapping" configuration key at validation secti… | Q | A | | --- | --- | | Bug fix? | no | | New feature? | yes | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | #15655 | | License | MIT | | Doc PR | symfony/symfony-docs#7407 | This feature allows you, to define additional validation files or directories which are not in the 'Bundle*/Resources/config/' directory. ``` yaml #config.yml framework: validation: mapping: paths: - "path/to/file/validation.yml" - "path/to/file/validation.xml" - "path/to/another/directory" ``` Commits ------- d696cfb [FrameworkBundle] Configurable paths for validation files 60d7d43 fix merge 61475b5 Merge branch '3.2' ba41e70 Merge branch '3.1' into 3.2 4268aba Merge branch '2.8' into 3.1 3faf655 Merge branch '2.7' into 2.8 e95fc09 fix getMock usage 482828c fix merge ed5eb6d bug #21372 [DependencyInjection] Fixed variadic method parameter in autowired classes (brainexe) a7f63de [DependencyInjection] Fixed variadic method parameter in autowired classes 9ef4271 minor #21371 [Validator] update German translation (xabbuh) f920e61 update German translation 41c72ab minor #21335 [Validator] Improved error message for missing upload_tmp_dir (Breuls) afbf227 [Validator] Improved error message for missing upload_tmp_dir
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Autowiring classes containing methods with variadic method parameter throws a ReflectionException in compile process:
Example: