Commit Graph

25632 Commits

Author SHA1 Message Date
Fabien Potencier
570bebdcb3 Merge branch '2.7' into 2.8
* 2.7:
  prefer getSourceContext() over getSource()
  [HttpFoundation] Avoid implicit null to array conversion in request matcher
  Revert "bug #20184 [FrameworkBundle] Convert null prefix to an empty string in translation:update (chalasr)"
  Update UPGRADE-2.7.md
2016-11-07 11:34:39 -08:00
Fabien Potencier
40dc73aa28 bug #20440 [TwigBridge][TwigBundle][HttpKernel] prefer getSourceContext() over getSource() (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBridge][TwigBundle][HttpKernel] prefer getSourceContext() over getSource()

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

Commits
-------

adbc529 prefer getSourceContext() over getSource()
2016-11-07 11:32:26 -08:00
Christian Flothmann
adbc529b7b prefer getSourceContext() over getSource() 2016-11-07 19:42:43 +01:00
Fabien Potencier
589d019f2e minor #20433 Revert "bug #20184 [FrameworkBundle] Convert null prefix to an empty string in translation:update (chalasr)" (chalasr)
This PR was merged into the 2.7 branch.

Discussion
----------

Revert "bug #20184 [FrameworkBundle] Convert null prefix to an empty string in translation:update (chalasr)"

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

This reverts commit 3f650f8 because the fix is not valid.
It is actually not possible to have an option with value optional given empty to be `empty` if this one has a default value. The default value will always be the one returned, see https://github.com/symfony/symfony/pull/20184#discussion_r85265689 for details.

Commits
-------

b2fa7c4 Revert "bug #20184 [FrameworkBundle] Convert null prefix to an empty string in translation:update (chalasr)"
2016-11-07 07:14:01 -08:00
Fabien Potencier
fd1ee25ebd minor #20275 [HttpFoundation] Avoid implicit null to array conversion in request matcher (ro0NL)
This PR was squashed before being merged into the 2.7 branch (closes #20275).

Discussion
----------

[HttpFoundation] Avoid implicit null to array conversion in request matcher

| Q | A |
| --- | --- |
| Branch? | 2.7 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any |
| License | MIT |
| Doc PR | reference to the documentation PR, if any |

`null` is allowed _and_ passed as default value from the constructor. Lets be explicit.

Commits
-------

a2c0a78 [HttpFoundation] Avoid implicit null to array conversion in request matcher
2016-11-07 07:11:09 -08:00
Roland Franssen
a2c0a785c2 [HttpFoundation] Avoid implicit null to array conversion in request matcher 2016-11-07 07:11:08 -08:00
Fabien Potencier
2b0c863f6c minor #20431 Update UPGRADE-2.7.md (Aliance)
This PR was merged into the 2.7 branch.

Discussion
----------

Update UPGRADE-2.7.md

See [Symfony/Component/Form/AbstractTypeExtension.php](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/AbstractTypeExtension.php)

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

Commits
-------

1c0f572 Update UPGRADE-2.7.md
2016-11-07 07:09:26 -08:00
Robin Chalas
b2fa7c4f07 Revert "bug #20184 [FrameworkBundle] Convert null prefix to an empty string in translation:update (chalasr)"
This reverts commit 3f650f864c, reversing
changes made to 962248dbd9.
2016-11-07 13:32:19 +01:00
Lesnykh Ilia
1c0f572d2e Update UPGRADE-2.7.md 2016-11-07 10:23:54 +03:00
Fabien Potencier
a66e9ff77e Merge branch '2.7' into 2.8
* 2.7:
  [Translation][fallback] add missing resources in parent catalogues.
  removed a deprecation notice
  [Form] Fix show float values as choices values in ChoiceType
  [HttpFoundation][Session] memcached connection should not be closed
2016-11-06 08:21:30 -08:00
Fabien Potencier
8668aec34e minor #20421 Twig deprecation removal (fabpot)
This PR was merged into the 2.7 branch.

Discussion
----------

Twig deprecation removal

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

eb0d6c9 removed a deprecation notice
2016-11-06 08:13:45 -08:00
Fabien Potencier
b06c00edcd bug #20422 [Translation][fallback] add missing resources in parent catalogues. (aitboudad)
This PR was merged into the 2.7 branch.

Discussion
----------

[Translation][fallback] add missing resources in parent catalogues.

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

Commits
-------

27c91e5 [Translation][fallback] add missing resources in parent catalogues.
2016-11-06 08:10:50 -08:00
Fabien Potencier
94d9bfbc1d bug #20378 [Form] Fixed show float values as choice value in ChoiceType (yceruto)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fixed show float values as choice value in ChoiceType

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

There is a closed [issue][1] related to this before Symfony 2.7 (when choice value still was the key from the `array`). This issue already happened in 2.7+ but now inside Symfony core.

Information
-----------

[This method][3] checks whether the given choices can be cast to strings without generating duplicates (3ab8189080 in #16705):

```php
private function castableToString(array $choices, array &$cache = array())
{
    foreach ($choices as $choice) {
        if (is_array($choice)) {
            if (!$this->castableToString($choice, $cache)) {
                return false;
            }

            continue;
        } elseif (!is_scalar($choice)) {
            return false;
        } elseif (isset($cache[$choice])) {  // <---- red breakpoint
            return false;
        }

        $cache[$choice] = true; // <---- red breakpoint
    }

    return true;
}
```

So it should to keep [scalar values (integer, float, string or boolean)][2] as choice values always (unless have duplicates values).

The Problem
-----------

But in this situation it doesn't happen:

```php
$form = $this->createFormBuilder()
    ->add('foo', ChoiceType::class, [
        'choices' => [
            'Min' => 0.5,
            'Mid' => 1.0,
            'Max' => 1.5,
        ]
    ])
    ->getForm();
```

**Output:**

```html
<select id="form_foo" name="form[foo]">
  <option value="0">Min</option>
  <option value="1">Mid</option>
  <option value="2">Max</option>
</select>
```

[**Why?**][5]

If the key of the array is a float number, it's interpreted as integer automatically:

```php
// ...

$cache[$choice] = true;

// when $choice = 0.5: $cache = [0 => true]
// when $choice = 1.0: $cache = [0 => true, 1 => true]
```

Then, when `$choice = 1.5` [this sentence][4] `isset($cache[1.5])` returns `true` because really checks `isset($cache[1])` and this key already exists, so `castableToString()` returns `false` (detected as duplicate) and the choices values are generated incrementing integers as values.

The PR's Effect
-------------

**Before:**

```html
<select id="form_foo" name="form[foo]">
  <option value="0">Min</option>
  <option value="1">Mid</option>
  <option value="2">Max</option>
</select>
```

**After:**

```html
<select id="form_foo" name="form[foo]">
  <option value="0.5">Min</option>
  <option value="1">Mid</option>
  <option value="1.5">Max</option>
</select>
```

  [1]: https://github.com/symfony/symfony/issues/13817
  [2]: http://php.net/manual/en/function.is-scalar.php
  [3]: https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php#L228
  [4]: https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php#L239
  [5]: https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php#L243

Commits
-------

3564228 [Form] Fix show float values as choices values in ChoiceType
2016-11-06 08:03:54 -08:00
Abdellatif Ait boudad
27c91e514e [Translation][fallback] add missing resources in parent catalogues. 2016-11-06 08:07:39 +00:00
Fabien Potencier
eb0d6c94ca removed a deprecation notice 2016-11-05 23:09:07 -07:00
Yonel Ceruto
35642288fa [Form] Fix show float values as choices values in ChoiceType 2016-11-05 14:02:34 -04:00
Fabien Potencier
3dcbdfdd39 minor #20414 [Console] Fix double use Statement (Jan Emrich)
This PR was merged into the 2.8 branch.

Discussion
----------

[Console] Fix double use Statement

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

Commits
-------

c3dacbb Remove double use Statement
2016-11-04 11:59:40 -07:00
Jan Emrich
c3dacbb9a1 Remove double use Statement
Syntax Error in Helper/QuestionHelper.php
2016-11-04 18:49:05 +01:00
Fabien Potencier
8fd97217e7 bug #20294 Improved the design of the metrics in the profiler (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #20294).

Discussion
----------

Improved the design of the metrics in the profiler

| 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 |  |
- Performance panel now displays Sub-Requests a bit separated from the normal metrics
- Singular/plural: when there is 1 sub-request, we don't display "sub-request**s**" anymore
### Before

![before_subrequests](https://cloud.githubusercontent.com/assets/73419/19680261/5289fd26-9aa5-11e6-8702-1ac50997da78.png)
### After

![after_subrequests](https://cloud.githubusercontent.com/assets/73419/19680272/57324b44-9aa5-11e6-8d85-44cc089bd9f4.png)
- Add bottom margin to metrics so they are correctly displayed when the screen is very small.
### Before & After

![metrics-small-screens](https://cloud.githubusercontent.com/assets/73419/19680259/4f826654-9aa5-11e6-9ed8-1ffe9a3db8bf.png)

Commits
-------

d030a9d Improved the design of the metrics in the profiler
2016-11-04 08:17:22 -07:00
Javier Eguiluz
d030a9d403 Improved the design of the metrics in the profiler 2016-11-04 08:17:21 -07:00
Fabien Potencier
f37ac131e1 bug #20375 [HttpFoundation][Session] Fix memcache session handler (klandaika)
This PR was merged into the 2.7 branch.

Discussion
----------

[HttpFoundation][Session] Fix memcache session handler

| Q             | A
| ------------- | ---
| Branch?       | 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 3.0, 3.1, master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commit 0216e05605 removed the opening of connection to memcached server on call to `open()`, because it's assumed that connection is already opened. However, `close()` still closes the connection. As a result no more read/write calls can be made if session got closed, as the connection does not get reestablished.

Basically MemcacheSessionHandler should follow same logic as Memcache**d**SessionHandler, which is exactly what this MR acomplishes.

Commits
-------

0423d894 [HttpFoundation][Session] memcached connection should not be closed
2016-11-04 08:14:52 -07:00
Fabien Potencier
8d5c56348c Merge branch '2.7' into 2.8
* 2.7:
  [Console] Fix infinite loop on missing input
2016-11-04 08:10:10 -07:00
Fabien Potencier
74e65e1631 bug #20377 [Console] Fix infinite loop on missing input (chalasr)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix infinite loop on missing input

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

This fixes the infinite loop occurring when no input is provided for a question which has a validator and no max attempts (`null`), e.g. when using `SymfonyStyle::ask()` which automatically adds a validator.

Commits
-------

e64de1e [Console] Fix infinite loop on missing input
2016-11-04 08:09:28 -07:00
Robin Chalas
e64de1eac6 [Console] Fix infinite loop on missing input
[Console] Use console exception for missing input

Backport Console RuntimeException in 2.7
2016-11-03 09:51:57 +01:00
Nicolas Grekas
2b0cec528a Remove trailing space 2016-11-03 09:05:06 +01:00
Nicolas Grekas
37956db606 Merge branch '2.7' into 2.8
* 2.7:
  CS fixes
  Remove trailing space
  CS: apply rules
  [Yaml] Clean some messages + add test case
  [Form] Fix UrlType transforms valid protocols
  [SecurityBundle] Changed encoder configuration example to bcrypt
2016-11-03 08:52:58 +01:00
Nicolas Grekas
4eb003b653 CS fixes 2016-11-03 08:49:30 +01:00
Nicolas Grekas
1b4963bd84 Remove trailing space 2016-11-03 08:46:56 +01:00
Nicolas Grekas
0aca495522 minor #20364 CS: apply rules (keradus)
This PR was squashed before being merged into the 2.7 branch (closes #20364).

Discussion
----------

CS: apply rules

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

Commits
-------

22d4e15 CS: apply rules
2016-11-03 08:44:55 +01:00
Dariusz Ruminski
22d4e15634 CS: apply rules 2016-11-03 08:44:53 +01:00
Fabien Potencier
df130a35e4 minor #20388 [Yaml] Clean some messages + add test case (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] Clean some messages + add test case

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

Related to #20335 on 3.2.

Commits
-------

7520f7b [Yaml] Clean some messages + add test case
2016-11-02 14:11:25 -07:00
Nicolas Grekas
7520f7b937 [Yaml] Clean some messages + add test case 2016-11-02 15:01:29 +01:00
VJ
0423d894f4 [HttpFoundation][Session] memcached connection should not be closed 2016-11-02 08:42:51 -04:00
Fabien Potencier
779a6df81c bug #20372 [Console] simplified code (fabpot)
This PR was merged into the 2.8 branch.

Discussion
----------

[Console] simplified code

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | ~no~ yes (even if the output is "better" with this PR)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Instead of adding blank character for shorter lines and having to keep the max length of messages, I propose to clear the line via an ANSI sequence like done in the progress bar.

Code is cleaner and output is better as currently, then cursor can be "away" from the last character which is unexpected.

Actually, this is a bug fix as the current code does not work well when using styles in the indicator message.

Commits
-------

0aca9bf [Console] simplified code
2016-10-31 12:36:25 -07:00
Fabien Potencier
0aca9bf03c [Console] simplified code 2016-10-31 11:03:18 -07:00
Fabien Potencier
620ea20f49 bug #20342 [Form] Fix UrlType transforms valid protocols (ogizanagi)
This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #20342).

Discussion
----------

[Form] Fix UrlType transforms valid protocols

| 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

According to https://tools.ietf.org/html/rfc3986#section-3.1:

<details>
<summary>`scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )`</summary>
>   Each URI begins with a scheme name that refers to a specification for
   assigning identifiers within that scheme.  As such, the URI syntax is
   a federated and extensible naming system wherein each scheme's
   specification may further restrict the syntax and semantics of
   identifiers using that scheme.

>   Scheme names consist of a sequence of characters beginning with a
   letter and followed by any combination of letters, digits, plus
   ("+"), period ("."), or hyphen ("-").  Although schemes are case-
   insensitive, the canonical form is lowercase and documents that
   specify schemes must do so with lowercase letters.  An implementation
   should accept uppercase letters as equivalent to lowercase in scheme
   names (e.g., allow "HTTP" as well as "http") for the sake of
   robustness but should only produce lowercase scheme names for
   consistency.
</details>

~~Fixing the regex to add missing chars could solve the issue. However according to the RFC, we should not allow underscores. But `\w+` permits it (removing it would be a minor BC break anyway).~~

~~IMHO, we should not care in this listener if the scheme is valid or not (a validator should be used instead), so I'd suggest to simply check if a scheme is provided or not.~~ I'm not using `parse_url($string, PHP_URL_SCHEME)` because `http:/symfony.com` or `http:symfony.com`  is considered valid as containing a scheme.

Actually, I changed my mind about previous fix (28f816a) and went back to the regex, in order to have strings like `symfony.com?uri=http://example.com` properly transformed to `symfony.com?uri=http://example.com`

Commits
-------

46dd3b9 [Form] Fix UrlType transforms valid protocols
2016-10-30 08:33:18 -07:00
Maxime STEINHAUSSER
46dd3b9acb [Form] Fix UrlType transforms valid protocols 2016-10-30 08:33:18 -07:00
Fabien Potencier
16b29a16de minor #20301 [SecurityBundle] Changed encoder configuration example to bcrypt (jeremyFreeAgent)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #20301).

Discussion
----------

[SecurityBundle] Changed encoder configuration example to bcrypt

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

Simple change in the configuration example to help developers to not use `sha512` as encoder when using `config:dump-reference`.

Commits
-------

a55058f [SecurityBundle] Changed encoder configuration example to bcrypt
2016-10-30 08:29:28 -07:00
Jérémy Romey
a55058f097 [SecurityBundle] Changed encoder configuration example to bcrypt 2016-10-30 08:29:28 -07:00
Nicolas Grekas
d12f26992b Merge branch '2.7' into 2.8
* 2.7:
  Compatibility with Twig 1.27
  Enhance GAE compat by removing some realpath()
  bumped Symfony version to 2.7.21
  updated VERSION for 2.7.20
  update CONTRIBUTORS for 2.7.20
  updated CHANGELOG for 2.7.20
  [SecurityBundle] Fix twig-bridge lowest dep
2016-10-28 10:10:49 +02:00
Fabien Potencier
0572866184 bug #20292 Enhance GAE compat by removing some realpath() (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

Enhance GAE compat by removing some realpath()

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

The remaining ones are in test folders, or in things that don't run/have to run on GAE directly (e.g. commands).

Commits
-------

f2f232d Enhance GAE compat by removing some realpath()
2016-10-27 08:37:53 -07:00
Fabien Potencier
74ed9e1941 bug #20326 [VarDumper] Fix dumping Twig source in stack traces (nicolas-grekas)
This PR was merged into the 2.8 branch.

Discussion
----------

[VarDumper] Fix dumping Twig source in stack traces

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

Commits
-------

f16d44d [VarDumper] Fix dumping Twig source in stack traces
2016-10-27 08:05:40 -07:00
Fabien Potencier
0d545b27a3 bug #20321 Compatibility with Twig 1.27 (xkobal)
This PR was submitted for the 3.1 branch but it was merged into the 2.7 branch instead (closes #20321).

Discussion
----------

Compatibility with Twig 1.27

| Q             | A
| ------------- | ---
| Branch?       | "master" for new features / 2.7, 2.8 or 3.1 for fixes
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

In FilesystemLoader::findTemplate(), you must accept a second argument that when set to "false" returns "false" instead of throwing an exception. Not supporting this argument is deprecated since version 1.27.

Commits
-------

77c5395 Compatibility with Twig 1.27
2016-10-27 07:46:29 -07:00
Xavier HAUSHERR
77c5395a79 Compatibility with Twig 1.27 2016-10-27 07:46:29 -07:00
Nicolas Grekas
f16d44dbc6 [VarDumper] Fix dumping Twig source in stack traces 2016-10-27 14:02:32 +02:00
Nicolas Grekas
f2f232d599 Enhance GAE compat by removing some realpath() 2016-10-27 11:13:40 +02:00
Fabien Potencier
5abd889480 bumped Symfony version to 2.8.14 2016-10-26 19:36:03 -07:00
Fabien Potencier
d04e2eb13a Merge pull request #20315 from fabpot/release-2.8.13
released v2.8.13
2016-10-26 19:18:45 -07:00
Fabien Potencier
10b7b5da3b updated VERSION for 2.8.13 2016-10-26 19:18:22 -07:00
Fabien Potencier
5ea7fcc92b updated CHANGELOG for 2.8.13 2016-10-26 19:18:10 -07:00