instantiate valid commands only
Fixed exit code for exceptions with error code 0
merged branch Stelian/2.2 (PR #8183)

This PR was submitted for the 2.2 branch but it was merged into the 2.1 branch instead (closes #8183).

Discussion
----------

Fixed exit code for exceptions with error code 0

Covers https://github.com/symfony/symfony/issues/8180

Commits
-------

48e77f8 Fixed exit code for exceptions with error code 0
merged branch havvg/hotfix/fix-bundle-command-instantiation (PR #8182)

This PR was merged into the 2.2 branch.

Discussion
----------

[HttpKernel] instantiate valid commands only

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | debatable ..
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

This skips the default behavior to instantiate `Command` that cannot simply be instantiated. The respective commands have to be registered by other means.

Commits
-------

afad9c7 instantiate valid commands only
[Console] fix status code when Exception::getCode returns something like 0.1
[DomCrawler] Fixed a fatal error when setting a value in a malformed field name.
merged branch pylebecq/2.2 (PR #8221)

This PR was merged into the 2.2 branch.

Discussion
----------

[DomCrawler] Fixed a fatal error when setting a value in a malformed field name

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

Hi,

I found a case where a fatal error happen when trying to set a value in a form field with a malformed name.

```
Fatal error: Call to a member function setValue() on a non-object in /home/pierreyves/projects/symfony2/symfony/src/Symfony/Component/DomCrawler/FormFieldRegistry.php on line 128

Call Stack:
    0.0001     231832   1. {main}() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/composer/bin/phpunit:0
    0.0035     688768   2. PHPUnit_TextUI_Command::main() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/composer/bin/phpunit:63
    0.0035     689000   3. PHPUnit_TextUI_Command->run() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
    0.0224    2705448   4. PHPUnit_TextUI_TestRunner->doRun() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
    0.0301    2997392   5. PHPUnit_Framework_TestSuite->run() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
    0.0477    3613296   6. PHPUnit_Framework_TestSuite->runTest() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
    0.0477    3613296   7. PHPUnit_Framework_TestCase->run() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
    0.0477    3613296   8. PHPUnit_Framework_TestResult->run() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:776
    0.0478    3614208   9. PHPUnit_Framework_TestCase->runBare() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
    0.0478    3630992  10. PHPUnit_Framework_TestCase->runTest() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:831
    0.0478    3631856  11. ReflectionMethod->invokeArgs() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:976
    0.0478    3631888  12. Symfony\Component\DomCrawler\Tests\FormTest->testSetValueOnMultiValuedFieldsWithMalformedName() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:976
    0.0481    3635560  13. Symfony\Component\DomCrawler\Form->offsetSet() /home/pierreyves/projects/symfony2/symfony/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:255
    0.0481    3635560  14. Symfony\Component\DomCrawler\FormFieldRegistry->set() /home/pierreyves/projects/symfony2/symfony/src/Symfony/Component/DomCrawler/Form.php:320
```

In this case, `FormFieldRegistry::getSegments('foo[bar')` method is called and it will return `array('foo')` only. Therefore the return of `FormFieldRegistry::get('foo[bar')` returns an array instead of a `FormField` and so the `setValue()` call happen on the array which leads to the fatal error.

I tried to fix that. I don't know if it's the best way to do this so, as always, comments are welcome.

Commits
-------

bce6bd2 [DomCrawler] Fixed a fatal error when setting a value in a malformed field name.
[Console] ensure exit code between 0-254

255 is reserved by PHP and should not be used

also put this code inside the codeCoverageIgnore block because it cannot be tested with phpunit
fix many-to-many Propel1 ModelChoiceList
merged branch havvg/2.2 (PR #8240)

This PR was merged into the 2.2 branch.

Discussion
----------

[Propel1] fix many-to-many Propel1 ModelChoiceList

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

replaces #8223

Commits
-------

25e3abd fix many-to-many Propel1 ModelChoiceList
merged branch Tobion/console-status-code (PR #8202)

This PR was merged into the 2.1 branch.

Discussion
----------

[Console] fix status and exit code

Fix https://github.com/symfony/symfony/pull/8183#discussion_r4525267
and
http://www.php.net/manual/en/function.exit.php
> Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully.

Commits
-------

6b9180a [Console] ensure exit code between 0-254
445b2e3 [Console] fix status code when Exception::getCode returns something like 0.1
Revert "[Console] ensure exit code between 0-254"

This reverts commit 6b9180a23ded06648ea8c79251e96ce87dd5c94f.
Merge branch '2.1' into 2.2

* 2.1:
  Revert "[Console] ensure exit code between 0-254"
  [Console] ensure exit code between 0-254
  [Console] fix status code when Exception::getCode returns something like 0.1
  Fixed exit code for exceptions with error code 0
Merge branch '2.2' into 2.3

* 2.2:
  Revert "[Console] ensure exit code between 0-254"
  fix many-to-many Propel1 ModelChoiceList
  [Console] ensure exit code between 0-254
  [DomCrawler] Fixed a fatal error when setting a value in a malformed field name.
  [Console] fix status code when Exception::getCode returns something like 0.1
  Fixed exit code for exceptions with error code 0
  instantiate valid commands only

Conflicts:
	src/Symfony/Component/Console/Application.php