Commit Graph

24687 Commits

Author SHA1 Message Date
Fabien Potencier f3217c3bd1 minor #21903 [Yaml] Fix the tests (GuilhemN)
This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] Fix the tests

| 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        |

Fix tests that are currently useless (previously part of https://github.com/symfony/symfony/pull/19782).

Commits
-------

5107b94baf [Yaml] Fix the tests
2017-03-06 13:38:40 -08:00
Guilhem Niot 5107b94baf
[Yaml] Fix the tests 2017-03-06 21:37:41 +01:00
Fabien Potencier 44dc67dca8 minor #21898 [github] Add a reminder about CHANGELOG.md files (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[github] Add a reminder about CHANGELOG.md files

| 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        | -

Instead of calling for that each time, maybe this can help?

Commits
-------

cb452ee154 [github] Add a reminder about CHANGELOG.md files
2017-03-06 12:33:55 -08:00
Nicolas Grekas cb452ee154 [github] Add a reminder about CHANGELOG.md files 2017-03-06 21:03:23 +01:00
Fabien Potencier fda2472b02 minor #21902 [Filesystem] respect the umask argument in dumpFile() (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Filesystem] respect the umask argument in dumpFile()

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

In #21823 we introduced a small BC break: The `dumpFile()` method of the `Filesystem` class allowed to pass the desired file permissions (support for this feature was dropped in Symfony 3.0).

Commits
-------

3a7cd08fe7 respect the umask argument in dumpFile()
2017-03-06 11:24:50 -08:00
Christian Flothmann 3a7cd08fe7 respect the umask argument in dumpFile() 2017-03-06 19:56:39 +01:00
Fabien Potencier c91db73fbb bug #21823 dumpFile(), preserve existing file permissions (chs2)
This PR was squashed before being merged into the 2.7 branch (closes #21823).

Discussion
----------

dumpFile(), preserve existing file permissions

When calling Filesystem::dumpFile() on an already existing file, its permissions are lost.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->

Commits
-------

040a9abdbf dumpFile(), preserve existing file permissions
2017-03-06 10:29:47 -08:00
ChS 040a9abdbf dumpFile(), preserve existing file permissions 2017-03-06 10:29:45 -08:00
Fabien Potencier 3effed88e0 bug #21865 [Security] context listener: hardening user provider handling (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Security] context listener: hardening user provider handling

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

After the wrong fix in #21791 this is the second attempt to solve #4498. If more than one user provider support the user for the current context, all of them will be applied instead of returning prematurely when the first user provider does not find the logged in user.

Commits
-------

0fb09293fd context listener: hardening user provider handling
2017-03-06 08:15:02 -08:00
Fabien Potencier ec134c7014 bug #21883 [HttpKernel] fix Kernel name when stored in a directory starting with a number (fabpot)
This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel] fix Kernel name when stored in a directory starting with a number

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

replaces #20750

Commits
-------

f244eb8414 [HttpKernel] fixed Kernel name when stored in a directory starting with a number
2017-03-06 07:51:41 -08:00
Nicolas Grekas 24f3135b11 minor #21886 [Form] Add validate method to mockec validator in form TypeTestCase (pierredup)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Add validate method to mockec validator in form TypeTestCase

| 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

When using the `Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase` class to unit test forms, the `validate` method is not mocked, which causes errors when the unit tests run.

Commits
-------

4013e7b Add validate method to mockec validator in form TypeTestCase
2017-03-06 10:17:24 +01:00
Pierre du Plessis 4013e7b998 Add validate method to mockec validator in form TypeTestCase 2017-03-06 09:20:15 +02:00
Fabien Potencier 7311ef36e9 bumped Symfony version to 2.7.26 2017-03-05 18:34:03 -08:00
Fabien Potencier e22beacc93 Merge pull request #21884 from fabpot/release-2.7.25
released v2.7.25
2017-03-05 17:33:53 -08:00
Fabien Potencier cb24ce3b52 updated VERSION for 2.7.25 2017-03-05 17:33:35 -08:00
Fabien Potencier 48c19f67e1 update CONTRIBUTORS for 2.7.25 2017-03-05 17:33:23 -08:00
Fabien Potencier f90c78efe1 updated CHANGELOG for 2.7.25 2017-03-05 17:33:13 -08:00
Fabien Potencier f244eb8414 [HttpKernel] fixed Kernel name when stored in a directory starting with a number 2017-03-05 14:37:48 -08:00
Fabien Potencier 4816f65c04 minor #21882 [Form] Fixed typo in a test after #21877 (HeahDude)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fixed typo in a test after #21877

| 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        | ~

Reviewing the diff on GitHub, I realized I've missed some typos in a new test of #21877. Sorry!

Commits
-------

b21a0978de [Form] Fixed typo in a test after #21877
2017-03-05 11:48:05 -08:00
Fabien Potencier 511e0c372a minor #21868 [Form] backport DependencyInjectionExtension tests (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] backport DependencyInjectionExtension tests

| 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        |

Commits
-------

97361f1815 [Form] backport DependencyInjectionExtension tests
2017-03-05 11:42:52 -08:00
Christian Flothmann 97361f1815 [Form] backport DependencyInjectionExtension tests 2017-03-05 20:15:18 +01:00
HeahDude b21a0978de [Form] Fixed typo in a test after #21877 2017-03-05 20:10:06 +01:00
Fabien Potencier ea8025b863 minor #21877 [Form] Hardened form type tests (HeahDude)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Hardened form type tests

| 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        | ~

This one the PRs to come targeting 2.7 needed to harden the code base before doing some changes in master.

It takes care of the form types tests part (even if some other tests will be added later, it will also be easier after it), and unlocks merging https://github.com/symfony/symfony/pull/21481.
It also back ports tests added in https://github.com/symfony/symfony/pull/18357 for the TextType.

Since it's very hard to merge branches when modifying tests because of BC, and making every test type extend the base type test would involve many function calls to get the tested type, the function `getTestedType` is no longer abstract and return a constant to override instead, it's much better for performance, I didn't change the call in the base type test to keep BC but I suggest to deprecate it in master. Even if those are tests I really think it is worth keeping BC here.

The constants also ease testing in the ecosystem of form related libraries that need to be compatible with Symfony 2.7 and 3. I think using "test" as both prefix and suffix on namespaces, classes and names of the constants should discourage using them in real application code. Since this is just about our test suite, I don't think this should be considered a feature, so tis change should be good for 2.7.

Two other PRs will follow to solve conflicts in 2.8 and 3.2.

I missed last month patches, I hope I won't this time :).

Commits
-------

8cfc3e92ed [Form] Hardened form type tests
2017-03-05 09:34:46 -08:00
Fabien Potencier 69bb7582ad bug #21671 [Serializer] Xml encoder throws exception for valid data (gr1ev0us)
This PR was squashed before being merged into the 2.7 branch (closes #21671).

Discussion
----------

[Serializer] Xml encoder throws exception for valid data

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

#21617  Xml encoder throws exception for valid data

- add tests for bool and object encoding
- fix encoding for object in array and field

Commits
-------

5c2d4c671e [Serializer] Xml encoder throws exception for valid data
2017-03-05 09:23:36 -08:00
gr1ev0us 5c2d4c671e [Serializer] Xml encoder throws exception for valid data 2017-03-05 09:23:23 -08:00
HeahDude 8cfc3e92ed [Form] Hardened form type tests 2017-03-05 17:53:01 +01:00
Fabien Potencier fd94048285 fixed CS 2017-03-04 06:54:02 -08:00
Christian Flothmann 0fb09293fd context listener: hardening user provider handling 2017-03-04 13:36:23 +01:00
Nicolas Grekas d75ca7fa44 minor #21864 [Security] fix Composer constraint (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Security] fix Composer constraint

| 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        |

The `MAX_USERNAME_LENGTH` constant introduced by #18733 that is used in the `UsernamePasswordFormAuthenticationListener` was first part of Symfony 2.7.13 and 2.8.6.

Commits
-------

69a572d [Security] fix Composer constraint
2017-03-04 13:01:21 +01:00
Christian Flothmann 69a572dc5d [Security] fix Composer constraint 2017-03-04 12:40:30 +01:00
Nicolas Grekas af40fd789c minor #21862 [Security] fix test class location (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Security] fix test class location

| 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        |

Keeping the test file in the old location means that it is not available in the `symfony/security-http` subtree split.

Commits
-------

1ed0092 fix test class location
2017-03-04 11:57:10 +01:00
Nicolas Grekas d45008d2d1 bug #21805 Provide less state in getRequestFormat (dawehner)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #21805).

Discussion
----------

Provide less state in getRequestFormat

Let's assume you multiple lines of code calling to ```Request::getRequestFormat```providing different default values.

```
$request->getRequestFormat();
$request->getRequestFormat('json')
```

As of HEAD this causes the second call to return 'html', unless its set explicit via ```setRequestFormat()```.

IMHO this is state which can be avoided.

Note: This also helps Drupal.

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

Commits
-------

1d43007 Provide less state in getRequestFormat
2017-03-04 11:53:39 +01:00
Daniel Wehner 1d43007f3c Provide less state in getRequestFormat 2017-03-04 11:53:31 +01:00
Christian Flothmann 1ed0092a62 fix test class location 2017-03-04 11:20:42 +01:00
Nicolas Grekas 5898ec2c5e minor #21855 SCA with Php Inspections (EA Extended) (kalessil)
This PR was merged into the 2.7 branch.

Discussion
----------

SCA with Php Inspections (EA Extended)

| 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

Commits
-------

e1773ee Static code analysis with Php Inspections (EA Extended): dead code dropped, couple bugs fixed
2017-03-04 10:49:48 +01:00
Vladimir Reznichenko e1773ee2b8 Static code analysis with Php Inspections (EA Extended): dead code dropped, couple bugs fixed 2017-03-03 17:35:37 +01:00
Nicolas Grekas 9a2b2de64f [HttpFoundation] Fix Request::getHost() when having several hosts in X_FORWARDED_HOST 2017-03-03 11:02:41 +01:00
Fabien Potencier cb12e323a5 minor #21814 fixed CS (fabpot)
This PR was merged into the 2.7 branch.

Discussion
----------

fixed CS

| 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
-------

ad0bb6ac53 fixed CS
2017-03-02 13:32:57 -08:00
Fabien Potencier c579b96cef bug #21832 [Routing] Ignore hidden directories when loading routes from annotations (jakzal)
This PR was merged into the 2.7 branch.

Discussion
----------

[Routing] Ignore hidden directories when loading routes from annotations

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

The problem surfaced after implementing #18869. Therefore it doesn't exist on 2.7, but I'd still merge it there to avoid conflicts when merging between branches. Without this fix, the oldest branch the added test will fail is 3.2.

Commits
-------

ce9df0237c [Routing] Ignore hidden directories when loading routes from annotations
2017-03-02 07:54:09 -08:00
Fabien Potencier 058121819c bug #21769 [Form] Improve rounding precision (foaly-nr1)
This PR was squashed before being merged into the 2.7 branch (closes #21769).

Discussion
----------

[Form] Improve rounding precision

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

For full details see https://github.com/symfony/symfony/issues/21734 from https://github.com/symfony/symfony/issues/21734#issuecomment-282552802 onwards.

Excerpt:

```php
$number = floor(37.37*100); // double(3736)
var_dump($number);
$number = floor(bcmul(37.37, 100)); // double(3737)
var_dump($number);
```

From http://php.net/manual/en/language.types.float.php#language.types.float:

> Additionally, rational numbers that are exactly representable as floating point numbers in base 10, like 0.1 or 0.7, do not have an exact representation as floating point numbers in base 2, which is used internally, no matter the size of the mantissa. Hence, they cannot be converted into their internal binary counterparts without a small loss of precision. This can lead to confusing results: for example, floor((0.1+0.7)*10) will usually return 7 instead of the expected 8, since the internal representation will be something like 7.9999999999999991118....
>
> So never trust floating number results to the last digit, and do not compare floating point numbers directly for equality. If higher precision is necessary, the arbitrary precision math functions and gmp functions are available.

Commits
-------

e50804cef4 [Form] Improve rounding precision
2017-03-02 07:52:24 -08:00
foaly-nr1 e50804cef4 [Form] Improve rounding precision 2017-03-02 07:52:21 -08:00
Jakub Zalas ce9df0237c
[Routing] Ignore hidden directories when loading routes from annotations 2017-03-02 14:51:26 +00:00
Fabien Potencier ad0bb6ac53 fixed CS 2017-03-01 11:43:24 -08:00
Fabien Potencier a786b5aaaf revert typo fix 2017-03-01 06:59:13 -08:00
Fabien Potencier 817524889c bug #21267 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily (issei-m)
This PR was squashed before being merged into the 2.7 branch (closes #21267).

Discussion
----------

[Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily

| 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        | -

Fixed ChoiceType to protect against some problem caused by treating of array.

Let's say we have the choice-form like:

```php
$form = $factory->create(ChoiceType, null, [
    'choices' => [
        'A',
        'B',
        'C',
    ],
    'expanded' => true,
    'multiple' => true,
]);
```

Then, submit data like this:

```php
$form->submit([
    [], // unnecessality nested
]);
```

(Yes, I agree in most cases these situation doesn't happen, but can be)

Then, we get `array_flip(): Can only flip STRING and INTEGER values!` error at [here](6babdb3296/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php (L114)).
Even if form is not `multiple`, annoying `Array to string conversion` error occurs in [here](6babdb3296/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php (L144)) (via [ChoicesToValuesTransformer](5129c4cf7e/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php (L74))).
(As far as I know, non-multiple and non-expanded form has no problem, thanks to [ChoiceToValueTransformer](6babdb3296/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php (L43)))

To resolve these problems, I just added a simple-validation listener to choice type.

Commits
-------

64d7a82d28 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
2017-03-01 06:57:41 -08:00
Issei.M 64d7a82d28 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily 2017-03-01 06:57:38 -08:00
Fabien Potencier 0a15eea264 minor #21650 [Yaml] add tests for specific mapping keys (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] add tests for specific mapping keys

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | see https://github.com/symfony/symfony/pull/21643#discussion_r101703130
| License       | MIT
| Doc PR        |

Commits
-------

b8e0d705f6 [Yaml] add tests for specific mapping keys
2017-03-01 06:39:50 -08:00
Fabien Potencier ffc1cd507b bug #21731 Fix emacs link (rubenrua)
This PR was merged into the 2.7 branch.

Discussion
----------

Fix emacs link

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes (minor)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

When an Emacs buffer is modified, by default Emacs automatically creates a
temporary symlink in the same directory as the file being edited (e.g. Controller.php):

```
.#Controller.php -> user@host.12345:1296583136
```

where '12345' is [the Emacs' PID][1].

In this case Symfony breaks with a RuntimeException:

```
SplFileInfo::getMTime(): stat failed for ...Bundle/Controller/.#APIController.php
```

in
vendor/symfony/symfony/src/Symfony/Component/Config/Resource/DirectoryResource.php
at line 89

```
$newestMTime = max($file->getMTime(), $newestMTime);
```

[1]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html

Commits
-------

c6f7ca6fa1 Fix RuntimeException when an Emacs buffer is modified
2017-03-01 06:05:48 -08:00
Fabien Potencier 908d470749 minor #21804 [Console] Test inline styles with non-decorated formatter (julienfalque)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Test inline styles with non-decorated formatter

| 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        | -

Small improvement of `OutputFormatter` test.

Commits
-------

8530e05574 Test inline styles with non-decorated formatter
2017-02-28 14:11:15 -08:00
Julien Falque 8530e05574
Test inline styles with non-decorated formatter 2017-02-28 19:03:12 +01:00