Commit Graph

32541 Commits

Author SHA1 Message Date
Nicolas Grekas
b1b686081b Merge branch '3.3' into 3.4
* 3.3:
  Revert "bug #24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)"
  [Filesystem] skip tests if not applicable
  [Fabbot] Do not run php-cs-fixer if there are no change in src/
  [Security] Fix exception when use_referer option is true and referer is not set or empty
  [HttpKernel] "controller.service_arguments" services should be public
  Get KERNEL_DIR through $_ENV too for KernelTestCase
  Get KERNEL_CLASS through $_ENV too
  check permissions if dump target dir is missing
2017-09-11 08:29:22 +02:00
Nicolas Grekas
483a274994 Merge branch '2.8' into 3.3
* 2.8:
  Revert "bug #24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)"
  [Filesystem] skip tests if not applicable
  [Fabbot] Do not run php-cs-fixer if there are no change in src/
  [Security] Fix exception when use_referer option is true and referer is not set or empty
  Get KERNEL_DIR through $_ENV too for KernelTestCase
  check permissions if dump target dir is missing
2017-09-11 07:57:23 +02:00
Fabien Potencier
565a1c4b48 minor #24007 [ExpressionLanguage] SyntaxError : make a proposal when no function or variable found (fmata)
This PR was merged into the 3.4 branch.

Discussion
----------

[ExpressionLanguage] SyntaxError : make a proposal when no function or variable found

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

Now when an Expression fails to be parsed, a SyntaxError is raised with an explicit message but it's impossible to extract the function, variable or the pair token  type/token value to parse.
When a functional user encounters a SyntaxError, by default there is no mechanism to understand why what he typed is incorrect.

This PR exposes when it's possible the subject of the violation and in case of function or variable undefined in the Expression, a proposal is made.

```php
<?php

require 'vendor/autoload.php';

use Symfony\Component\ExpressionLanguage\Lexer;
use Symfony\Component\ExpressionLanguage\Parser;
use Symfony\Component\ExpressionLanguage\SyntaxError;

$lexer = new Lexer();
$parser = new Parser(array());

try {
    $parser->parse($lexer->tokenize('user.city.departement in [departement, departement2]'), array('user', 'departement1', 'departement2'));
} catch (SyntaxError $e) {
    echo $e->getMessage();
}
```
Outputs :

> Variable "departement" is not valid around position 27 for expression `user.city.departement in [departement, departement2]`.
>
> Did you mean "departement1"?

Commits
-------

f19cf8a916 [ExpressionLanguage] make a proposal in SyntaxError message
2017-09-10 16:46:16 -07:00
Fabien Potencier
a0bdd5a2cb bug #24132 [SecurityBundle] Fix valid provider considered undefined (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[SecurityBundle] Fix valid provider considered undefined

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

Silly mistake.

Commits
-------

efa4cb9a66 [SecurityBundle] Fix valid provider considered undefined
2017-09-09 12:41:02 -07:00
Robin Chalas
efa4cb9a66 [SecurityBundle] Fix valid provider considered undefined 2017-09-09 12:20:30 +02:00
Nicolas Grekas
a5130b29c6 minor #24130 Fixed deprecations in WebProfiler tests (javiereguiluz)
This PR was merged into the 3.4 branch.

Discussion
----------

Fixed deprecations in WebProfiler tests

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

To avoid this error in tests:

```
The "web_profiler.position" configuration key has been deprecated in Symfony 3.4 and it will be removed in 4.0: 1x
    1x in ConfigurationTest::testConfigTree from Symfony\Bundle\WebProfilerBundle\Tests\DependencyInjection
```

Can anybody propose a better solution to fix this issue? Thanks!

Commits
-------

2a696d3 Fixed deprecations in WebProfiler tests
2017-09-09 08:11:27 +02:00
Javier Eguiluz
2a696d3a1e Fixed deprecations in WebProfiler tests 2017-09-09 08:10:24 +02:00
Fabien Potencier
d6dfb5b4e3 Merge branch '2.7' into 2.8
* 2.7:
  Revert "bug #24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)"
  [Filesystem] skip tests if not applicable
  [Fabbot] Do not run php-cs-fixer if there are no change in src/
  [Security] Fix exception when use_referer option is true and referer is not set or empty
  Get KERNEL_DIR through $_ENV too for KernelTestCase
  check permissions if dump target dir is missing
2017-09-08 18:12:52 -07:00
Fabien Potencier
7793b797af Revert "bug #24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)"
This reverts commit d74144fc0b, reversing
changes made to 2b79f48405.
2017-09-08 18:12:06 -07:00
Fabien Potencier
1677d9cddb minor #24073 [Console] Fix BC break in console.command.ids parameter (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Fix BC break in console.command.ids parameter

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/flex/issues/142#issuecomment-326029873
| License       | MIT
| Doc PR        | n/a

To make command services lazy loaded when their name is known, we need to exclude them from [runtime registration of other (non lazy-loadable) command services](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Console/Application.php#L176).
We also need to have them in the `console.command.ids` parameter in order to [not register them by convention](https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/HttpKernel/Bundle/Bundle.php#L188).
It is managed using `false` as values instead of ids for the parameter, [excluding false values from runtime registration](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Console/Application.php#L177). Problem is that it makes FrameworkBundle's 3.3 Application incompatible with Console 3.4+ given the check for `false` is missing.

This PR fixes it using another parameter referencing ids of command services which can be lazy loaded.
I would be happy to not add the parameter if someone has a suggestion that allows to do so.

Commits
-------

99e95c3d2d Fix BC break in console.command.ids parameter
2017-09-08 09:59:15 -07:00
Nicolas Grekas
3145006053 minor #24137 [Filesystem] skip tests if not applicable (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Filesystem] skip tests if not applicable

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

1605ce1 [Filesystem] skip tests if not applicable
2017-09-08 16:53:30 +02:00
Christian Flothmann
1605ce1f07 [Filesystem] skip tests if not applicable 2017-09-08 16:43:09 +02:00
Fabien Potencier
9a6e83af16 minor #24139 [Fabbot] Do not run php-cs-fixer if there are no change in src/ (lyrixx)
This PR was merged into the 2.7 branch.

Discussion
----------

[Fabbot] Do not run php-cs-fixer if there are no change in src/

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

Commits
-------

3eb79e5197 [Fabbot] Do not run php-cs-fixer if there are no change in src/
2017-09-08 06:57:11 -07:00
Grégoire Pineau
3eb79e5197 [Fabbot] Do not run php-cs-fixer if there are no change in src/ 2017-09-08 15:50:13 +02:00
Robin Chalas
eff73bd60e feature #24131 [Console] Do not display short exception trace for common console exceptions (yceruto)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Do not display short exception trace for common console exceptions

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

![console_before](https://user-images.githubusercontent.com/2028198/30173516-edb9e42c-93c5-11e7-882e-f8b0335387b3.png)

I'd like reconsider [the new error output][1] with short exception trace always displayed at top, IMHO it's annoying for common exceptions (there is not real debugging reason, the message is clear enough) such as `Symfony\Component\Console\Exception\*` which have an impact into current CLI applications.

However, I'm proposing display it for unexpected exceptions or if verbosity is enabled:

![console](https://user-images.githubusercontent.com/2028198/30173085-94322636-93c4-11e7-81a6-bba807910e62.png)

Note @nicolas-grekas's https://github.com/symfony/symfony/pull/21414#issuecomment-326013025 is still covered.

 [1]: https://github.com/symfony/symfony/pull/21414

Commits
-------

47b1106 Do not display short exception trace for built-in console exceptions
2017-09-07 22:10:16 +02:00
Yonel Ceruto
47b1106868 Do not display short exception trace for built-in console exceptions 2017-09-07 11:50:16 -04:00
Florent Mata
f19cf8a916 [ExpressionLanguage] make a proposal in SyntaxError message 2017-09-07 17:13:34 +02:00
Fabien Potencier
c97c6d48b3 feature #24080 Deprecated the web_profiler.position option (javiereguiluz)
This PR was squashed before being merged into the 3.4 branch (closes #24080).

Discussion
----------

Deprecated the web_profiler.position option

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #23528
| License       | MIT
| Doc PR        | -

Related to #23728, which removes the feature for Symfony 4.0.

Commits
-------

53387b4335 Deprecated the web_profiler.position option
2017-09-07 08:02:00 -07:00
Javier Eguiluz
53387b4335 Deprecated the web_profiler.position option 2017-09-07 08:01:45 -07:00
Fabien Potencier
b6a29a28db bug #24101 [Security] Fix exception when use_referer option is true and referer is not set or empty (linniksa)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #24101).

Discussion
----------

[Security] Fix exception when use_referer option is true and referer is not set or empty

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

Commits
-------

a29e0694de [Security] Fix exception when use_referer option is true and referer is not set or empty
2017-09-07 07:52:52 -07:00
Sergey Linnik
a29e0694de [Security] Fix exception when use_referer option is true and referer is not set or empty 2017-09-07 07:52:52 -07:00
Fabien Potencier
22c00283bb feature #24114 [SecurityBundle] Throw a meaningful exception when an undefined user provider is used inside a firewall (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[SecurityBundle] Throw a meaningful exception when an undefined user provider is used inside a firewall

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

Before

> The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.undefined_provider".

After

> Invalid firewall "main": user provider "undefined_provider" not found.

Commits
-------

b884c6612d Throw a meaningful exception when an undefined user provider is used inside a firewall
2017-09-07 07:47:43 -07:00
Fabien Potencier
7dfb5aa321 feature #24122 [DI] rename ResolveDefinitionTemplatesPass to ResolveChildDefinitionsPass (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] rename ResolveDefinitionTemplatesPass to ResolveChildDefinitionsPass

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

Because that name makes things harder to understand now.
This uses exactly the same BC layer logic as the one we have for the renaming of DefinitionDecorator to ChildDefinition.

Commits
-------

a7f98c60d9 [DI] rename ResolveDefinitionTemplatesPass to ResolveChildDefinitionsPass
2017-09-07 07:45:15 -07:00
Fabien Potencier
d74144fc0b bug #24105 [Filesystem] check permissions if dump target dir is missing (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Filesystem] check permissions if dump target dir is missing

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

`is_dir()` returns `false` if the parent directory misses the executable
bit even when the directory itself is present.

Commits
-------

a0f9f2c537 check permissions if dump target dir is missing
2017-09-07 07:43:15 -07:00
Fabien Potencier
1bfa6a9ff7 feature #23901 [DI] Allow processing env vars (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Allow processing env vars

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

This PR is an updated version of #20276 ~~(it embeds #23899 for now.)~~

It superscedes/closes:
- [DI] Add support for secrets #23621 ping @dunglas
- Runtime container parameter not found event filter #23669 ping @marfillaster
- [DependencyInjection] [DX] Support for JSON string environment variables #23823 ping @Pierstoval
- add support for composite environment variables #17689 ping @greg0ire
- [DI] ENV parameters at runtime with PHP 7 strict types not working properly #20434 ping @sandrokeil
- Issue when using a SQLite database and the DATABASE_URL env var #23527 ping @javiereguiluz

#22151 is another story, so not fixed here.

The way it works is via `%env(foo:BAR)%` prefixes, where "foo" can be bound to any services you'd like.
By default, the following prefixes are supported:
- `bool`, `int`, `float`, `string`, `base64`
- `const` (for referencing PHP constants)
- `json` (supporting only json **arrays** for type predictability)
- `file` (eg for access to secrets stored in files.)
- `resolve` (for processing parameters inside env vars.)

New prefixes can be added by implementing the new `EnvProviderInterface`, and tagging with `container.env_provider` (see `Rot13EnvProvider` in tests.)

Prefixes can be combined to chain processing, eg.
`%env(json:base64:file:FOO)%` will be roughly equivalent to
`json_decode(base64_decode(file_get_content(getenv('FOO'))))`.

Commits
-------

1f92e459db [DI] Allow processing env vars
2017-09-07 07:23:45 -07:00
Fabien Potencier
1c04cd563a bug #24126 [HttpKernel] "controller.service_arguments" services should be public (nicolas-grekas)
This PR was merged into the 3.3 branch.

Discussion
----------

[HttpKernel] "controller.service_arguments" services should be public

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

Controller-as-services need to be public if they have constructor arguments (they don't need to if they have no arguments but that's for arcane reasons.)
Since services tagged "controller.service_arguments" *are* controllers, they need to be public to enhance DX and remove some WTFs that some ppl reported to me.

Commits
-------

b9c6928d7e [HttpKernel] "controller.service_arguments" services should be public
2017-09-07 07:05:07 -07:00
Nicolas Grekas
b9c6928d7e [HttpKernel] "controller.service_arguments" services should be public 2017-09-07 14:08:26 +02:00
Nicolas Grekas
a7f98c60d9 [DI] rename ResolveDefinitionTemplatesPass to ResolveChildDefinitionsPass 2017-09-07 10:45:01 +02:00
Robin Chalas
b884c6612d Throw a meaningful exception when an undefined user provider is used inside a firewall 2017-09-07 10:19:55 +02:00
Nicolas Grekas
fda994b1e4 bug #24113 [FrameworkBundle] Get KERNEL_CLASS through $_ENV too for KernelTestCase (yceruto)
This PR was merged into the 3.3 branch.

Discussion
----------

[FrameworkBundle] Get KERNEL_CLASS through $_ENV too for KernelTestCase

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/recipes/pull/170/files#diff-793b024840ee04ebdff5e04c2cd44f8cR12
| License       | MIT
| Doc PR        | -

I guess the check could be simplied in `master` with php7+

/cc @nicolas-grekas

Commits
-------

73cdb68 Get KERNEL_CLASS through $_ENV too
2017-09-07 09:25:08 +02:00
Nicolas Grekas
2b79f48405 bug #24115 [FrameworkBundle] Get KERNEL_DIR through $_ENV too for KernelTestCase (yceruto)
This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Get KERNEL_DIR through $_ENV too for KernelTestCase

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

See https://github.com/symfony/symfony/pull/24113

Commits
-------

cf11fb9 Get KERNEL_DIR through $_ENV too for KernelTestCase
2017-09-07 09:24:29 +02:00
Nicolas Grekas
1f92e459db [DI] Allow processing env vars 2017-09-07 08:08:52 +02:00
Yonel Ceruto
cf11fb9652 Get KERNEL_DIR through $_ENV too for KernelTestCase 2017-09-06 18:24:46 -04:00
Nicolas Grekas
2fde0942ac fix the fix 2017-09-06 23:01:01 +02:00
Nicolas Grekas
367c4d9810 Fix deps=low tests 2017-09-06 22:50:21 +02:00
Nicolas Grekas
8015ad60cc Fix merge 2017-09-06 21:47:44 +02:00
Yonel Ceruto
73cdb68308 Get KERNEL_CLASS through $_ENV too 2017-09-06 15:05:48 -04:00
Nicolas Grekas
e565c6de00 Merge branch '3.3' into 3.4
* 3.3:
  [travis] fix minor php7.0 version
  [travis] add ldap.so for php70
  [HttpFoundation] Fix logic when JsonSerializable is missing
  [travis] update to trusty
  Don't use return on Assert::markTestSkipped.
  Create directories recursively in the PHPUnit bridge
  [Dotenv] Add a BC break note
  Fix ArrayInput::toString() for VALUE_IS_ARRAY options/args
  [ExpressionLanguage] throws an exception on calling uncallable method
2017-09-06 21:03:12 +02:00
Nicolas Grekas
5f5ed69bea minor #24112 [travis] fix minor php7.0 version (nicolas-grekas)
This PR was merged into the 3.3 branch.

Discussion
----------

[travis] fix minor php7.0 version

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

7.0.7 is the default on travis-trusty, but we need 7.0.8 mini...

Commits
-------

0793365 [travis] fix minor php7.0 version
2017-09-06 21:00:36 +02:00
Nicolas Grekas
07933655e8 [travis] fix minor php7.0 version 2017-09-06 20:49:53 +02:00
Nicolas Grekas
9431a38cfc Merge branch '2.8' into 3.3
* 2.8:
  [travis] add ldap.so for php70
  [HttpFoundation] Fix logic when JsonSerializable is missing
2017-09-06 19:07:39 +02:00
Nicolas Grekas
e4ce14d073 [travis] add ldap.so for php70 2017-09-06 19:03:33 +02:00
Nicolas Grekas
9d240de539 Merge branch '2.7' into 2.8
* 2.7:
  [HttpFoundation] Fix logic when JsonSerializable is missing
2017-09-06 18:54:42 +02:00
Nicolas Grekas
d1fe4153a1 [HttpFoundation] Fix logic when JsonSerializable is missing 2017-09-06 18:53:48 +02:00
Nicolas Grekas
87b3b1a685 Merge branch '2.8' into 3.3
* 2.8:
  [travis] update to trusty
  Fix ArrayInput::toString() for VALUE_IS_ARRAY options/args
  [ExpressionLanguage] throws an exception on calling uncallable method
2017-09-06 18:40:18 +02:00
Christian Flothmann
a0f9f2c537 check permissions if dump target dir is missing
`is_dir()` returns `false` if the parent directory misses the executable
bit even when the directory itself is present.
2017-09-06 18:35:18 +02:00
Nicolas Grekas
c3f14708f4 Merge branch '2.7' into 2.8
* 2.7:
  [travis] update to trusty
  Fix ArrayInput::toString() for VALUE_IS_ARRAY options/args
  [ExpressionLanguage] throws an exception on calling uncallable method
2017-09-06 18:32:38 +02:00
Nicolas Grekas
cf4f8325e9 minor #24108 [travis] update to trusty (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[travis] update to trusty

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

Precise is dying, see https://blog.travis-ci.com/2017-08-31-trusty-as-default-status

Commits
-------

cfc9346 [travis] update to trusty
2017-09-06 18:22:23 +02:00
Nicolas Grekas
cfc9346f66 [travis] update to trusty 2017-09-06 17:42:52 +02:00
Fabien Potencier
1022bb497d minor #24060 [Yaml] add inline parser context initializer (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml] add inline parser context initializer

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

Calling the parser to initialize some internal context does not look
like a good idea. Additionally, this change allows to not accept null
values in `Inline::parse()` in 3.4 anymore.

Commits
-------

1be23c2a86 [Yaml] add inline parser context initializer
2017-09-06 08:08:15 -07:00