Commit Graph

28250 Commits

Author SHA1 Message Date
Nicolas Grekas
cd8b9d962b fix merge 2016-11-09 19:33:39 +01:00
Nicolas Grekas
a81b048127 Merge branch '3.1'
* 3.1:
  [Cache] Make directory hashing case insensitive
2016-11-09 19:19:25 +01:00
Fabien Potencier
a524ba5e77 bug #20453 [Cache] Make directory hashing case insensitive (nicolas-grekas)
This PR was merged into the 3.1 branch.

Discussion
----------

[Cache] Make directory hashing case insensitive

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

Fixes this situation: a Windows OS, running a Debian via VirtualBox and Vagrant. So the cache folder is on a Windows partition while the PHP command is running inside Debian...

Not testable without this specific setup...

Commits
-------

6d4a658 [Cache] Make directory hashing case insensitive
2016-11-09 09:59:43 -08:00
Fabien Potencier
6f58c766a6 bug #20428 [TwigBundle] fixed template root path (fabpot)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[TwigBundle] fixed template root path

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

Commits
-------

526b8a0 [TwigBundle] fixed template root path
2016-11-09 09:48:38 -08:00
Roland Franssen
dd47295c15 fixed phpdoc 2016-11-09 17:27:48 +00:00
Grégoire Pineau
51dad72a06 [Workflow] Set the marking then announce enabled transition
It allows to auto-apply some transition from a listener.

The feature was asked here: https://twitter.com/gaetanbuellet/status/796387741420441600
And It has been implemented in userland here:
https://github.com/lyrixx/SFLive-Paris2016-Workflow/tree/auto-apply
2016-11-09 17:46:34 +01:00
Fabien Potencier
ae73f70403 feature #20447 [DI] Force env params to be string|null (nicolas-grekas)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[DI] Force env params to be string|null

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

Commits
-------

93c25f8 [DI] Force env params to be string|null
2016-11-09 08:22:00 -08:00
Fabien Potencier
7e53eab232 minor #20446 [Command] remove exception annotation from run method (Karim Miladi)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #20446).

Discussion
----------

[Command] remove exception annotation from run method

| Q             | A
| ------------- | ---
| Branch?       | master
| 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
-------

5a1bf6a [Command] Fixed method comments as phpDoc syntax
2016-11-09 08:10:25 -08:00
Karim Miladi
5a1bf6aa6e [Command] Fixed method comments as phpDoc syntax 2016-11-09 08:10:25 -08:00
Grégoire Pineau
eb1498155b minor #20462 [Workfow] Rename current MarkingStore (lyrixx)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Workfow] Rename current MarkingStore

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes (in un-released branch)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

* ScalarMarkingStore -> SingleStateMarkingStore
* PropertyAccessorMarkingStore -> MultipleStateMarkingStore

And I also made optionnal the `marking_store` config, to let the
componant choose the best marking store depending on the type
(state_machine or workflow).

---

Note: I did that to ease the on-boarding

Commits
-------

08464c9 [Workfow] Rename current MarkingStore
2016-11-09 16:39:39 +01:00
Grégoire Pineau
08464c9f2c [Workfow] Rename current MarkingStore
* ScalarMarkingStore -> SingleStateMarkingStore
* PropertyAccessorMarkingStore -> MultipleStateMarkingStore

And I also made optionnal the `marking_store` config, to let the
componant choose the best marking store depending on the type
(state_machine or workflow).
2016-11-09 16:22:39 +01:00
Grégoire Pineau
61b1334c42 feature #20451 [Workflow] Added Definition builder (Nyholm)
This PR was squashed before being merged into the 3.2-dev branch (closes #20451).

Discussion
----------

[Workflow] Added Definition builder

| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes (in un-released branch)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | Related to #20441
| License       | MIT
| Doc PR        | n/a

Make the Definition immutable and add a DefinitionBuilder.

I basically broke up the Definition class into an immutable class and one builder.

Commits
-------

ffaeba3 [Workflow] Added Definition builder
2016-11-09 16:20:41 +01:00
Tobias Nyholm
ffaeba39fc [Workflow] Added Definition builder 2016-11-09 16:20:37 +01:00
Nicolas Grekas
6d4a658ab7 [Cache] Make directory hashing case insensitive 2016-11-09 15:09:05 +01:00
Grégoire Pineau
c6b664c4e9 bug #20460 [FrameworkBundle] Fixed WorkflowCommand to support state machines (HeahDude)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[FrameworkBundle] Fixed WorkflowCommand to support state machines

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

Commits
-------

4fcce4c [FrameworkBundle] Fixed WorkflowCommand to support state machines
2016-11-09 14:56:08 +01:00
HeahDude
4fcce4c465 [FrameworkBundle] Fixed WorkflowCommand to support state machines 2016-11-09 13:57:17 +01:00
Fabien Potencier
4bd6206d2e minor #20448 Added single quotes for upgrade guides. (Aliance)
This PR was merged into the 2.8 branch.

Discussion
----------

Added single quotes for upgrade guides.

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

Commits
-------

2016031 Added single quotes for upgrade guides.
2016-11-08 06:54:55 -08:00
Nicolas Grekas
93c25f8872 [DI] Force env params to be string|null 2016-11-08 15:49:28 +01:00
Lesnykh Ilia
201603137c
Added single quotes for upgrade guides. 2016-11-08 16:51:01 +03:00
Robin Chalas
b5a1584c52
[FrameworkBundle] Add --no-prefix option to translation:update
Remove ending dot from option description for consistency
2016-11-07 20:37:55 +01:00
Fabien Potencier
b376d92320 Merge branch '3.1'
* 3.1:
  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:59 -08:00
Fabien Potencier
790e7dd74d Merge branch '2.8' into 3.1
* 2.8:
  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:53 -08:00
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
Fabien Potencier
a6ea24e36f feature #19629 [Workflow] Make the Workflow support State Machines (Nyholm, lyrixx)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Workflow] Make the Workflow support State Machines

| Q | A |
| --- | --- |
| Branch? | "master" |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | yes, getEnabledTransistions does not return an assoc array. |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | Fixes #19605, Closes #19607 |
| License | MIT |
| Doc PR | https://github.com/symfony/symfony-docs/pull/6871 |

While researching for the docs of the component I've found that:
- A Workflow is a subclass of a Petri net
- A state machine is subclass of a Workflow
- A state machine must not be in many places simultaneously.

This PR adds a new interface to the marking store that allow us to validate the transition to true if ANY _input_ (froms) place matches the _tokens_ (marking). The default behavior is that ALL input places must match the tokens.

Commits
-------

9e49198 [Workflow] Made the code more robbust and ease on-boarding
bdd3f95 Make the Workflow support State Machines
2016-11-07 11:23:53 -08:00
Grégoire Pineau
9e491982cf [Workflow] Made the code more robbust and ease on-boarding 2016-11-07 20:11:39 +01:00
Tobias Nyholm
bdd3f95da6 Make the Workflow support State Machines 2016-11-07 20:11:39 +01: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
526b8a04fd [TwigBundle] fixed template root path 2016-11-06 12:23:45 -08:00
Fabien Potencier
53b55fca36 minor #20424 [HttpKernel] Removed forgotten setCacheVersionInfo() (ro0NL)
This PR was squashed before being merged into the 3.2-dev branch (closes #20424).

Discussion
----------

[HttpKernel] Removed forgotten setCacheVersionInfo()

| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no-ish
| 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

Forgotten in #14351

Commits
-------

8e70193 [HttpKernel] Removed forgotten setCacheVersionInfo()
2016-11-06 10:43:42 -08:00
Roland Franssen
8e70193e99 [HttpKernel] Removed forgotten setCacheVersionInfo() 2016-11-06 10:43:40 -08:00
Fabien Potencier
a8967ba625 fixed deprecation notices 2016-11-06 08:27:54 -08:00
Fabien Potencier
38bf11939b fixed test 2016-11-06 08:25:04 -08:00
Fabien Potencier
832686b7a2 Merge branch '3.1'
* 3.1:
  fixed CS
  Properly format value in UniqueEntityValidator
  [Translation][fallback] add missing resources in parent catalogues.
  removed a deprecation notice
  [Form] Fix show float values as choices values in ChoiceType
  Remove double use Statement
  Improved the design of the metrics in the profiler
  [Yaml] set arguments depending on the PHP version
  [Console] Fix infinite loop on missing input
  [HttpFoundation][Session] memcached connection should not be closed
2016-11-06 08:24:48 -08:00
Fabien Potencier
0255cb143f Merge branch '2.8' into 3.1
* 2.8:
  [Translation][fallback] add missing resources in parent catalogues.
  removed a deprecation notice
  [Form] Fix show float values as choices values in ChoiceType
  Remove double use Statement
  Improved the design of the metrics in the profiler
  [Console] Fix infinite loop on missing input
  [HttpFoundation][Session] memcached connection should not be closed
2016-11-06 08:23:47 -08: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
ba8a12a898 fixed CS 2016-11-06 08:20:57 -08:00
Fabien Potencier
a42973ee36 bug #20287 Properly format value in UniqueEntityValidator (alcaeus)
This PR was merged into the 3.1 branch.

Discussion
----------

Properly format value in UniqueEntityValidator

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

This PR fixes a small issue introduced in #15279. Having an array in a field considered for a unique check causes an array to string conversion error in the translator. This can be avoided by formatting the value parameter with `formatValue`.

Commits
-------

9043a55 Properly format value in UniqueEntityValidator
2016-11-06 08:15:28 -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
Andreas Braun
9043a551b2
Properly format value in UniqueEntityValidator 2016-11-06 10:18:09 +01:00
Abdellatif Ait boudad
27c91e514e [Translation][fallback] add missing resources in parent catalogues. 2016-11-06 08:07:39 +00:00
Fabien Potencier
2dd77a6b9b feature #20416 [Bridge\Monolog][FrameworkBundle] Add & wire a DebugProcessor (nicolas-grekas)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Bridge\Monolog][FrameworkBundle] Add & wire a DebugProcessor

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

As identified in #20370, collecting the log records for the profiler should happen before any processor.
The only way to do so is by registering a processor to do exactly that.
Since the last added processor is called first, this one is wired in a compiler pass that is called after other processors are registered.

The DebugHandler class being now useless, it is deprecated.
If this approach is accepted, I'll send a PR on monolog bundle & silex to leverage it.

Commits
-------

7572a53 [Bridge\Monolog][FrameworkBundle] Add & wire a DebugProcessor
2016-11-06 00:17:03 -07:00