This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures
Fabien Potencier c927c481aa bug #25255 [Console][DI] Fail gracefully (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console][DI] Fail gracefully

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/flex/issues/212, #25280
| License       | MIT
| Doc PR        | -

I already experienced this issue a few times without spending time digging it:
sometimes, you call `cache:clear`, and the command quits without any output, and with 255 status code.

The reason is the `@include` in `Kernel`, which makes everything silent, especially fatal errors (thanks PHP...)
So if the to-be-removed container is broken for some fatal reason, the failure is really bad.

To fix that, here are two measures:
- use `include_once` instead of `require_once` in the dumped container: that's OK there to actually not immediately load the file, any hard failure will happen later anyway, and any soft failure will allow the `cache:clear` command to complete (like when you remove a package)
- register `Application::renderException()` as the main PHP exception handler, via `Debug::ErrorHandler` when it's available

End result when it fails:
![image](https://user-images.githubusercontent.com/243674/33494543-e1d07202-d6c3-11e7-9677-bc2ae72fbba9.png)

instead of a blank output.

Commits
-------

4a5a3f52ab [Console][DI] Fail gracefully
2017-12-02 15:04:03 -08:00
..
config Throw on service:method factory notation in PHP-based DI configuration 2017-11-17 12:52:23 +03:00
containers [DI] Fix false-positive circular exception 2017-12-01 14:16:38 +01:00
directory [DI][Routing] recursive directory loading 2015-06-02 16:17:59 -07:00
graphviz [DI] Reference tagged services in config 2017-09-28 16:10:08 +02:00
includes Merge branch '3.3' into 3.4 2017-11-23 12:03:08 +01:00
ini [DI] FileLoaders: Allow to explicit type to load 2017-01-10 12:54:54 +01:00
php bug #25255 [Console][DI] Fail gracefully (nicolas-grekas) 2017-12-02 15:04:03 -08:00
Prototype [DI] Add "PHP fluent format" for configuring the container 2017-09-20 09:09:19 +02:00
xml feature #24484 [DI] Throw accurate failures when accessing removed services (nicolas-grekas) 2017-10-09 21:07:35 -07:00
yaml [DI] Fix cannot bind env var 2017-11-07 09:01:11 +01:00
array.json [DI] Allow processing env vars 2017-09-07 08:08:52 +02:00
Bar.php [DependencyInjection] Support local binding 2017-08-09 11:26:25 +02:00
BarInterface.php [DependencyInjection] Support local binding 2017-08-09 11:26:25 +02:00
CaseSensitiveClass.php Test that named arguments are prioritized over typehinted 2017-11-17 10:42:21 +02:00
CustomDefinition.php [DI] Fixed custom services definition BC break introduced in ec7e70fb… 2016-11-24 11:34:23 +01:00
DeprecatedClass.php [DI] Prevent AutowirePass from triggering irrelevant deprecations 2017-04-05 16:41:09 +02:00
FactoryDummy.php [DependencyInjection] Automatically detect the definitions class when possible 2016-07-31 12:30:18 +02:00
NamedArgumentsDummy.php [DependencyInjection] Support local binding 2017-08-09 11:26:25 +02:00
ParentNotExists.php [DI] Prevent a ReflectionException during cache:clear when the parent class doesn't exist 2017-11-27 10:49:34 +01:00
SimilarArgumentsDummy.php [DI] Remove scalar typehint in class used in test case 2017-11-19 14:43:05 +01:00
StubbedTranslator.php [DI] Test references inside ServiceLocator are not inlined 2017-04-29 20:26:40 +02:00
TestServiceSubscriber.php [DI] Restrict autowired registration to "same-vendor" namespaces 2017-04-06 11:28:30 +02:00