This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#18864).
Discussion
----------
[Console][DX] Fixed ambiguous error message when using a duplicate option shortcut
| Q | A
| ------------- | ---
| Branch? | 2.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #18856
| License | MIT
| Doc PR | -
I assume this should be merged into 2.3 as per @stof's comment.
There is a race condition when you run a command which has a duplicate option shortcut. Simply changing the order so that Options are merged before the Arguments solves that race condition.
````php
$this->setName('my:super:command')
->setAliases(['my:super:commandalias'])
->setDescription('Performs some irrelevant work.')
->addOption('survey', 'e', InputOption::VALUE_REQUIRED, 'My option with a shortcut.')
````
Gives the error message:
```
[Symfony\Component\Console\Exception\LogicException]
An argument with name "command" already exists.
```
This happens as the first time the definition is merged happens here:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L820
As this throws an error here:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Command/Command.php#L309
The commans are merged but not the options.
Merging it then again when the command is run
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Command/Command.php#L217
throws an error due to the duplicate argument as the arguments already have been merged. This time the error message is not surpressed and will confuse the user.
Changing the order should fix the issue for duplicate arguments as well as for duplicate options.
Commits
-------
7cb7655 [Console][DX] Fixed ambiguous error message when using a duplicate option shortcut
This PR was merged into the 2.7 branch.
Discussion
----------
Fix js comment in profiler
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Single line comment introduced in #18413 causes the toolbar to fail to load with a syntax error.
Commits
-------
91a2f5d Fix js comment in profiler
* 2.7:
[Yaml] fix exception contexts
People - person singularization
[Yaml] properly handle unindented collections
[Serializer] Add test for ignored attributes during denormalization
chomp newlines only at the end of YAML documents
Fixed server status command when port has been omitted
Update UPGRADE FROM 2.x to 3.0
Catch \Throwable
Use levenshtein level for better Bundle matching
[WebProfilerBundle] Fix CORS ajax security issues
* 2.3:
[Yaml] fix exception contexts
People - person singularization
[Yaml] properly handle unindented collections
chomp newlines only at the end of YAML documents
This PR was merged into the 2.8 branch.
Discussion
----------
Catch \Throwable
| Q | A
| ------------- | ---
| Branch? | 2.8, 3.0
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | Mostly!
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
The first commit is based on symfony/symfony#15949
Depends on symfony/symfony#18813, symfony/symfony#18812
----
I'm new to symfony, so I'm not sure where are all the places where it makes sense to actually catch the throwable and where not. I added most places that seemed logical and when I wasn't sure, I added it anyway. I'm hoping you guys (and girls?) can point out the places where the catch should not be added, I'll fix it and then I can create several PR's for the older branches. A lot of this IMHO should go also to 3.0.
Commits
-------
de671f4 Catch \Throwable
This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes#18839).
Discussion
----------
People - person singularization
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Bugfix for version 2.8 - more information [#18824]
Commits
-------
02070f9 People - person singularization
This PR was merged into the 2.3 branch.
Discussion
----------
[Yaml] chomp newlines only at the end of YAML documents
| Q | A
| ------------- | ---
| Branch? | 2.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #18784
| License | MIT
| Doc PR |
Commits
-------
a4b1fa6 chomp newlines only at the end of YAML documents
This PR was merged into the 2.7 branch.
Discussion
----------
[Serializer] Add test for ignored attributes during denormalization
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Commits
-------
c2f7fed [Serializer] Add test for ignored attributes during denormalization
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes#18814).
Discussion
----------
Fixed server status command when port has been omitted
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #18810
| License | MIT
| Doc PR | -
Modified the status command to behave exactly as the server:start command. When the port is omitted in the address argument the default port is added from the port option.
Commits
-------
94e4706 Fixed server status command when port has been omitted
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes#18772).
Discussion
----------
Update UPGRADE FROM 2.x to 3.0
| Q | A
| ------------- | ---
| Branch? | "master"
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | deprecated in 2.7 removed in 3.0
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | http://symfony.com/doc/2.8/reference/forms/types/text.html for starters
You missed the Form max_length option deprecation in several field types (Text, Password, Email, etc...).
Commits
-------
cd66a45 Update UPGRADE FROM 2.x to 3.0
This PR was merged into the 2.8 branch.
Discussion
----------
[DX][DependencyInjection] Make Autowiring exceptions more future friendly
| Q | A
| ------------- | ---
| Branch? | 2.8, 3.0
| Bug fix? | no (forward compatibility)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
This is a follow-up on #18766 (3.1, master) and #18691 (2.8, 3.0).
This PR changes the exception messages to the ones introduced in #18766 and #17877. I also unified the tests so they are exactly the same.
This way the error messages will be the same in 2.8 onward.
Commits
-------
834f550 [DX][DI] Make Autowiring exceptions more future friendly
This PR was merged into the 2.7 branch.
Discussion
----------
Use levenshtein level for better Bundle matching
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
_I've targetted 2.7 branch since this was introduced in the 2.6 version but the 2.6 isn't maintain anymore._
**TL;DR:** I found unused code in bad bundle exception when Symfony try to find the best bundle to fix the typo. Should we remove that code (and got a potential lower matching bundle name) or keep it and make it work?
-----
I've noticed that a part of the code wasn't used when determining which bundle typo was written on _bad bundle exception_, from https://github.com/symfony/symfony/pull/11210.
```php
$alternative = null;
$shortest = null;
foreach ($bundleNames as $bundleName) {
// if there's a partial match, return it immediately
if (false !== strpos($bundleName, $nonExistentBundleName)) {
return $bundleName;
}
$lev = levenshtein($nonExistentBundleName, $bundleName);
if ($lev <= strlen($nonExistentBundleName) / 3 && ($alternative === null || $lev < $shortest)) {
$alternative = $bundleName;
}
}
```
In this snippet, the `$shortest` wasn't update in the `foreach`. Reading the code, I guess it was supposed to add an even better accuracy when multiple bundle matche the typo'd bundle name.
Which mean when an alternative is found, we have to assign the level `$lev` from that match to `$shortest`.
```php
if ($lev <= strlen($nonExistentBundleName) / 3 && ($alternative === null || $lev < $shortest)) {
$alternative = $bundleName;
$shortest = $lev;
}
```
Let say you have these bundles: `FoooooBundle` and `FooBundle` and you request the bundle `FoodBundle`.
- Without `$shortest` updated, you'll got a suggestion with `FoooooBundle` (first matching bundle found)
- With `$shortest` upadted, you'll got a suggestion with `FooBundle` (because it has a better level than `FoooooBundle`)
This isn't a _bug fix_ since this is only supposed to help developper but not the final user.
**Question is**: should we keep that level comparison or just remove it?
Commits
-------
ac7f74e Use levenshtein level for better Bundle matching
This PR was merged into the 2.7 branch.
Discussion
----------
[2.7][WebProfilerBundle] Fix CORS ajax security issues
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
The WebProfiler toolbar monitors ajax requests. However, when using cross domain ajax requests, it triggers a security issues `Refused to get unsafe header "X-Debug-Token"` `Refused to get unsafe header "X-Debug-Token-Link"` because if the other app is not a Symfony App configured to expose these headers in CORS.
![image](https://cloud.githubusercontent.com/assets/137574/14225799/f462c09c-f8cf-11e5-925d-88be99945a92.png)
This fixes the issue. It adds a new configuration node to explicitly activate it on purpose.
Commits
-------
f8dd87d [WebProfilerBundle] Fix CORS ajax security issues
* 2.7:
Fix computation of PR diffs for component matrix lines
[BUG] Delete class 'control-group' in bootstrap 3
[2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper
This PR was merged into the 2.3 branch.
Discussion
----------
Fix computation of PR diffs for component matrix lines
| Q | A
| ------------- | ---
| Branch? | 2.3
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Validated on https://travis-ci.org/symfony/symfony/jobs/130061271 who fails otherwise.
Commits
-------
e7a3ae7 Fix computation of PR diffs for component matrix lines
This PR was submitted for the 3.0 branch but it was merged into the 2.7 branch instead (closes#18507).
Discussion
----------
[BUG] Delete class 'control-group' in bootstrap 3
| Q | A
| ------------- | ---
| Branch? | 3.0
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #18506
| License | MIT
| Doc PR | any
Commits
-------
99f61d6 [BUG] Delete class 'control-group' in bootstrap 3
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes#18747).
Discussion
----------
[2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
This bug was introduced in PR #17099. So does not represent in 2.8.2 or older.
If we have the following structure form:
```php
$builder = $formFactory->createBuilder();
$form = $builder
->add(
$builder->create('person1_name', FormType::class, ['inherit_data' => true])
->add('first', TextType::class, ['property_path' => '[person1_first_name]'])
->add('last', TextType::class, ['property_path' => '[person1_last_name]'])
)
->add(
$builder->create('person2_name', FormType::class, ['inherit_data' => true])
->add('first', TextType::class, ['property_path' => '[person2_first_name]'])
->add('last', TextType::class, ['property_path' => '[person2_last_name]'])
)
->getForm()
;
```
The following mapping for this form doesn't work correctly:
```php
$mapper = new ViolationMapper();
$mapper->mapViolation(new ConstraintViolation('', '', [], null, 'data[person1_first_name]', null), $form);
$form['person1_name']['first']->getErrors(); // empty
$form->getErrors(); // The violation is mapped to here instead.
```
## Cause
Because ViolationMapper uses `iterator_to_array` in [here](f29d46f29b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php (L165)) to collect the sub forms.
`person1_name` and `person2_name` enable `inherit_data` option. So ViolationMapper will attempt to collect the sub forms of root form like this:
```php
[
'first' => Form object, // root.person1_name.first
'last' => Form object, // root.person1_name.last
'first' => Form object, // root.person2_name.first
'last' => Form object, // root.person2_name.last
]
```
As you can see, The name `first` and `last` are used in two places, thus we cannot get result like that.
(first/last of person1_name are overwritten by person2_name's)
So the violation will finally lost the form where it should map to. It should pass `false` to `iterator_to_array`'s 2nd parameter.
Commits
-------
ae38660 [2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper
* 2.7:
added missing constant in Response
Update HTTP statuses list
[Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet
added StaticVerionStrategyTest
Add SplFileInfo array doc on Finder iterator methods so that IDE will know what it returns
[2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper
Updated the link to the list of currency codes
[console][table] adjust width of colspanned cell.
* 2.3:
Update HTTP statuses list
[Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet
Add SplFileInfo array doc on Finder iterator methods so that IDE will know what it returns
[2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper
Updated the link to the list of currency codes
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#18650).
Discussion
----------
Update HTTP statuses list
| Q | A
| ------------- | ---
| Branch? | 2.3
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
fa99fbd Update HTTP statuses list
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#18635).
Discussion
----------
[Console] Prevent fatal error when calling Command::getHelper without helperSet
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #18619
| License | MIT
| Doc PR | n/a
Patch attached to #18619
Commits
-------
31285c2 [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet