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

Skip to content

[DI] Fix AutowirePass fatal error with classes that have non-existing parents #18600

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
Apr 21, 2016

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Apr 20, 2016

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

@hason
Copy link
Contributor

hason commented Apr 20, 2016

@nicolas-grekas You are a PHP hacker. Great!


try {
spl_autoload_register($throwingAutoloader);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could even be outside the try/catch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas Very clever trick!

@stof
Copy link
Member

stof commented Apr 20, 2016

$typeHint = $parameter->getClass() on line 79 could also trigger the loading of a class without a parent class. Could we apply a similar trick there (we will need to set a meaningful exception message though, saying that the class does not exist) ?

@nicolas-grekas
Copy link
Member Author

@stof I wondered the same, but someone needs to give me a test case that would trigger the fatal error first :)

@stof
Copy link
Member

stof commented Apr 20, 2016

@nicolas-grekas register an autowired service for a class which has a constructor argument typehinted with a class which extend a missing class

@nicolas-grekas
Copy link
Member Author

@stof
Copy link
Member

stof commented Apr 20, 2016

👍

1 similar comment
@dunglas
Copy link
Member

dunglas commented Apr 21, 2016

👍

@dunglas
Copy link
Member

dunglas commented Apr 21, 2016

... and one more bug fixed, thank you @nicolas-grekas.

@dunglas dunglas merged commit 202cc77 into symfony:2.8 Apr 21, 2016
dunglas added a commit that referenced this pull request Apr 21, 2016
…on-existing parents (hason, nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[DI] Fix AutowirePass fatal error with classes that have non-existing parents

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

Commits
-------

202cc77 [DI] Fix AutowirePass fatal error with classes that have non-existing parents
1735b85 [DependencyInjection] Tests for AutowirePass with missing parent class
@nicolas-grekas nicolas-grekas deleted the no-parent branch April 21, 2016 12:17
This was referenced Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants