Commit Graph

19453 Commits

Author SHA1 Message Date
Wesley Lancel
c1ae7b6ad7 Prevent infinite loop in PropertyMetadata 2016-10-13 07:00:50 -07:00
Fabien Potencier
3f650f864c bug #20184 [FrameworkBundle] Convert null prefix to an empty string in translation:update (chalasr)
This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Convert null prefix to an empty string in translation:update

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

This command needs the ability to use an empty string as prefix, which is not possible using `bin/console translation:update --prefix=""` because `$argv` doesn't parse empty strings thus the value is converted to `null` by `ArgvInput` (only since #19946, before the option was not considered to be set, giving the default `'__'` thus this should be fine from a BC pov).

Here I propose to explicitly convert the `prefix` value to an empty string if set to `null`, as it is a very specific need and we can't guess that from `ArgvInput`.
An other way to fix it could be to add a `--no-prefix` option to the command but I don't think it is worth it, and it couldn't be treated as a bug fix thus not fixed before `3.2`.

Commits
-------

f02b687 [FrameworkBundle] Convert null prefix to an empty string in translation:update command
2016-10-09 04:27:22 -07:00
Robin Chalas
f02b6876b4
[FrameworkBundle] Convert null prefix to an empty string in translation:update command 2016-10-09 13:14:32 +02:00
Nicolas Grekas
dcf601f3fa Minor fixes & cleanups 2016-10-06 10:40:01 +02:00
Fabien Potencier
a5a91a7fa1 bug #19725 [Security] $attributes can be anything, but RoleVoter assumes strings (Jonatan Männchen)
This PR was merged into the 2.7 branch.

Discussion
----------

[Security] $attributes can be anything, but RoleVoter assumes strings

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18042
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

Commits
-------

ad3ac95 bug #18042 [Security] $attributes can be anything, but RoleVoter assumes strings
2016-10-05 18:42:44 -07:00
Roland Franssen
1159f8bba6 [HttpFoundation] JSONP callback validation 2016-10-05 12:15:52 -07:00
Fabien Potencier
df46bb774a bug #20163 add missing use statement (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

add missing use statement

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

Commits
-------

32451b1 add missing use statement
2016-10-05 10:41:39 -07:00
Javier Eguiluz
29226ef116 [Console] Improved the explanation of the hasOption() method 2016-10-05 10:26:56 -07:00
Christian Flothmann
32451b1a09 add missing use statement 2016-10-05 18:08:03 +02:00
Fabien Potencier
f4fe36a4e1 bug #19961 [Console] Escape question text and default value in SymfonyStyle::ask() (chalasr)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Escape question text and default value in SymfonyStyle::ask()

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

Commits
-------

eed3cc5 [Console] Escape default value and question in SymfonyStyle::ask()
2016-10-04 20:05:49 -07:00
Fabien Potencier
4c854e7329 bug #20141 [Console] Fix validation of empty values using SymfonyQuestionHelper::ask() (chalasr)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix validation of empty values using SymfonyQuestionHelper::ask()

| 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 `QuestionHelper::ask()` it's allowed to return an empty value as answer, e.g:

```php
$helper = new QuestionHelper();
$question = new Question('foo', false);
$question->setValidator(function ($v) { return $v; });
$answer = $helper->ask($input, $output, $question);
```

Just typing `enter` for answering this question works, the value of `$answer` would be `false`.
But doing the same with `SymfonyQuestionHelper::ask()`:

```php
$helper = new SymfonyQuestionHelper();
$question = new Question('foo', false);
$question->setValidator(function ($v) { return $v; });
$answer = $helper->ask($input, $output, $question);
```

>  [ERROR] A value is required.

Same for `''` or `null`.
Here I kept the same check but used as default validator, if a validator is set and allows an empty value to be returned then it's ok.

Also I am not sure about if this default validator should be kept, imho we should be consistent with the default question helper, using the `SymfonyQuestionHelper` should only impact the output.

Diff best viewed [like this](https://github.com/symfony/symfony/pull/20141/files?w=1)
ping @kbond

Commits
-------

a8b910b [Console] Fix validation of null values using SymfonyStyle::ask()
2016-10-04 19:49:41 -07:00
Fabien Potencier
21af4f0c11 bug #20147 [FrameworkBundle] Alter container class instead of kernel name in cache:clear command (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Alter container class instead of kernel name in cache:clear command

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

The decision to alter kernel's name instead of the container's class dates from cc3a40ed78
But this is causing issues such as #19912. Looking more carefully, the real intent is to change the container class and there is no need to alter also the kernel's name at this stage.

Commits
-------

73c9693 [FrameworkBundle] Alter container class instead of kernel name in cache:clear command
2016-10-04 19:28:53 -07:00
Nicolas Grekas
73c96939cd [FrameworkBundle] Alter container class instead of kernel name in cache:clear command 2016-10-04 16:32:03 +02:00
Nicolas Grekas
dda18df6de [VarDumper] Fix ReflectionNamedType->getName() detection 2016-10-04 14:01:35 +02:00
Robin Chalas
a8b910bec2
[Console] Fix validation of null values using SymfonyStyle::ask() 2016-10-04 00:20:32 +02:00
Fabien Potencier
3086fd38e5 bumped Symfony version to 2.7.20 2016-10-03 11:42:03 -07:00
Fabien Potencier
70afffbbff updated VERSION for 2.7.19 2016-10-03 11:15:49 -07:00
Fabien Potencier
9ed8d576e1 bug #20102 [Validator] Url validator not validating hosts ending in a number (gwkunze)
This PR was squashed before being merged into the 2.7 branch (closes #20102).

Discussion
----------

[Validator] Url validator not validating hosts ending in a number

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no (Should validate slightly more urls)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | None that I could find
| License       | MIT
| Doc PR        |

We ran into an issue where the URL validator wasn't validating URL that we got from a legitimate (intranet) URL. Afaict from skimming RFCs the URL `http://myhost123/` is valid, however the current regular expression doesn't accept the last part of a hostname (in this case the entire hostname is the last part as there are no periods in the host).

I've fixed this by adding the numbers unicode character property to the regular expression, I'm not sure but symbol characters (`\pS`) might need to be added to the group as well.

Commits
-------

934c434 [Validator] Url validator not validating hosts ending in a number
2016-10-03 09:05:36 -07:00
Gijs Kunze
934c434d33 [Validator] Url validator not validating hosts ending in a number 2016-10-03 09:05:35 -07:00
Javier Eguiluz
4403e28ab0 Use "more entropy" option for uniqid() 2016-10-03 08:22:03 -07:00
Fabien Potencier
80577f96bf bug #20122 [Validator] Reset constraint options (ro0NL)
This PR was merged into the 2.7 branch.

Discussion
----------

[Validator] Reset constraint options

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20106
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

I think it's good to reset the internal pointer of the options array if we depend on `key($options)`. I've added tests to clarify we intentionally check for the first key.

The current behavior actually differs for hhvm/php7 - https://3v4l.org/e6r6E

Commits
-------

4c6ddd4 reset constraint options
2016-10-02 08:50:33 -07:00
Roland Franssen
4c6ddd4737 reset constraint options 2016-10-01 21:36:38 +00:00
Fabien Potencier
996c1ee3cb added checks for public services on compiler passes that use service id and not references 2016-10-01 08:38:16 -07:00
Fabien Potencier
470dc3e36f [TwigBundle] added missing dependencies for tests 2016-10-01 07:16:30 -07:00
Fabien Potencier
e20cd8ae9f fixed CS 2016-09-30 12:35:09 -07:00
Fabien Potencier
c1c42a52bc bug #20078 Fix #19943 Make sure to process each interface metadata only once (lemoinem)
This PR was merged into the 2.7 branch.

Discussion
----------

Fix #19943 Make sure to process each interface metadata only once

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

Here is the fix for #19943, If you have `InterfaceA <- InterfaceB <- Class` with a constraint on a method defined on `InterfaceA`, the constraint and its eventual violations are currently validated and reported twice.

Copy from https://github.com/symfony/symfony/issues/19943#issuecomment-250238529:
As far as I can see, the problem seems to arise in [`LazyLoadingMetadataFactory`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php#L117-L123):

[`ReflectionClass::getInterfaces()`](http://php.net/manual/en/reflectionclass.getinterfaces.php) returns both interfaces implemented directly and through inheritance (either through another interface or through a parent class). In the end, the following process occurs:

1. `PriceInterface` is parsed and its `NotBlank` constraint on `value` is loaded
2. `VariablePriceInterface` is parsed and inherits `PriceInterface`'s constraints (which is OK).
3. `ProductPrice` is parsed and inherits both `PriceInterface` and `VariablePriceInterface`'s  constraints, which leads to a duplicated `NotBlank` constraint, one from each Interface.

The Best Way ™️ would be to be able to extract the list of interfaces implemented by a class directly only. However, the process seems a bit intricate... I will start working on it and prepare a PR to that effect. However, if any of you has a better idea, I'm all hears...

TODO:
- [x] Regression tests to make sure the bug doesn't reappear

Commits
-------

2f9b65a Fix #19943 Make sure to process each interface metadata only once
2016-09-30 12:33:15 -07:00
Tugdual Saunier
fcd6ec2a5e
[TwigBundle] Fix CacheWarmingTest are order dependent 2016-09-30 14:26:39 +01:00
Fabien Potencier
35091b1837 Revert "bug #20080 [Form] compound forms without children should be considered rendered implicitly (backbone87)"
This reverts commit eae5a9ba0b, reversing
changes made to fd763ad5a3.
2016-09-29 16:48:55 -07:00
Fabien Potencier
eae5a9ba0b bug #20080 [Form] compound forms without children should be considered rendered implicitly (backbone87)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] compound forms without children should be considered rendered implicitly

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

Commits
-------

8234f2a #17580 compound forms without children should be considered rendered implicitly
2016-09-29 09:02:32 -07:00
Nicolas Grekas
466dbe62b4 [2.7][VarDumper] Fix PHP 7.1 compat 2016-09-29 13:21:39 +01:00
Christian Flothmann
30c9b1ec28 silent file operation to avoid open basedir issues
Using file operations on a symlink that points to a file outside the
directories being allowed by the open_basedir setting leads to PHP
warnings being raised.
2016-09-28 19:20:21 -07:00
Fabien Potencier
24e9cf2155 fixed Twig support for 1.26 and 2.0 2016-09-28 18:04:26 -07:00
Mathieu Lemoine
2f9b65aa5a Fix #19943 Make sure to process each interface metadata only once 2016-09-28 18:39:11 -04:00
Oliver Hoff
8234f2add4 #17580 compound forms without children should be considered rendered
implicitly
2016-09-28 21:40:37 +02:00
Fabien Potencier
da6c664e98 minor #20064 [Console] Format JSON fixtures (ro0NL)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Format JSON fixtures

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| 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

Should make merging upstream easier due better diffs.

```php
foreach (glob('src/Symfony/Component/Console/Tests/Fixtures/*.json') as $file) {
    file_put_contents($file, str_replace(PHP_EOL, "\n", json_encode(json_decode(trim(file_get_contents($file))), JSON_PRETTY_PRINT))."\n");
}
```

Should be re-applied on 2.8, 3.1 and master.

Commits
-------

2ca7823 format json fixtures
2016-09-27 17:09:53 -07:00
Fabien Potencier
40c2cbd12b bug #19951 [Finder] Trim trailing directory slash in ExcludeDirectoryFilterIterator (ro0NL)
This PR was merged into the 2.7 branch.

Discussion
----------

[Finder] Trim trailing directory slash in ExcludeDirectoryFilterIterator

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19599
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

In this context `path` equals `path/`

Commits
-------

e0e5f0c apply rtrim
2016-09-27 17:07:53 -07:00
Roland Franssen
2ca78233a1 format json fixtures 2016-09-27 17:33:51 +00:00
Roland Franssen
b074a7156a Fixed expectedException annotations 2016-09-23 11:13:36 -07:00
Fabien Potencier
fc0fe87c6d minor #20027 Security and validators messages translation to Latvian (Rikijs)
This PR was merged into the 2.7 branch.

Discussion
----------

Security and validators messages translation to Latvian

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

Commits
-------

ff72f21 Security and validators messages translation to Latvian
2016-09-22 09:52:50 -07:00
Rikijs Murgs
ff72f21427 Security and validators messages translation to Latvian 2016-09-22 19:04:04 +03:00
Sergio Santoro
40af42cb60 [Form] FormView->isRendered() remove dead code and simplify the flow 2016-09-21 22:14:19 +02:00
Fabien Potencier
bb51ed0d20 Revert "minor #20011 Use UUID for error codes for Form validator. (Koc)"
This reverts commit 2cd45a5043, reversing
changes made to d8423071de.
2016-09-21 12:03:56 -07:00
Konstantin.Myakshin
6dbb186f23 Use UUID for error codes for Form validator. 2016-09-21 10:52:48 -07:00
Fabien Potencier
d8423071de bug #20010 [DX] Fixed regression when exception message swallowed when logging it. (Koc)
This PR was merged into the 2.7 branch.

Discussion
----------

[DX] Fixed regression when exception message swallowed when logging it.

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | maybe, wait for Travis
| Fixed tickets | fixed regression introduced in #13418
| License       | MIT
| Doc PR        | -

The problem is: after merging referenced PR we cann't understand what error occured and why authentication request failed (see attached screenshot). Previously it displays exception message, but now it only displays class of the exception.

![9003644109](https://cloud.githubusercontent.com/assets/191082/18717550/f0df61c4-8028-11e6-8dbb-684e4928e913.jpg)

Commits
-------

042cb6b Fixed regression when exception message swallowed when logging it.
2016-09-21 10:05:38 -07:00
Konstantin.Myakshin
042cb6b2b2 Fixed regression when exception message swallowed when logging it. 2016-09-21 18:21:51 +03:00
Jakub Zalas
b482fb784e [HttpFoundation] Enable memcached tests with the latest memcached extension 2016-09-21 12:21:12 +01:00
Jonatan Männchen
ad3ac95d2d
bug #18042 [Security] $attributes can be anything, but RoleVoter assumes strings 2016-09-21 07:35:02 +00:00
Nicolas Grekas
0d9dacc6db [VarDumper] Fix extra whitespace 2016-09-20 15:04:49 +02:00
Fabien Potencier
12350c2eb1 [TwigBridge] removed Twig null nodes (deprecated as of Twig 1.25) 2016-09-19 12:59:08 -07:00
Robin Chalas
eed3cc5b52
[Console] Escape default value and question in SymfonyStyle::ask() 2016-09-18 17:48:17 +02:00