Commit Graph

29677 Commits

Author SHA1 Message Date
Robin Chalas
02b4aaa25f
[HttpKernel] Lazy load argument value resolvers 2017-02-02 20:36:37 +01:00
Fabien Potencier
03b7cf72dc feature #21419 [DI][Config] Add & use ReflectionClassResource (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI][Config] Add & use ReflectionClassResource

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

With new changes comming to 3.3, we need a more generic reflection tracking logic than the one already managed by the autowiring subsystem.

This PR adds a new ReflectionClassResource in the Config component, and a new ContainerBuilder::getReflectionClass() method in the DI one (for fetching+tracking reflection-related info).

ReflectionClassResource tracks changes to any public or protected properties/method.

PR updated and ready, best viewed [ignoring whitespaces](https://github.com/symfony/symfony/pull/21419/files?w=1).

changelog:

* added `ReflectionClassResource` class
* added second `$exists` constructor argument to `ClassExistenceResource` - with a special mode that prevents fatal errors from happening when some parent class is broken (logic generalized from AutowiringPass)
* made `ClassExistenceResource` also work with interfaces and traits
* added `ContainerBuilder::getReflectionClass()` for retrieving and tracking reflection class info
* deprecated `ContainerBuilder::getClassResource()`, use `ContainerBuilder::getReflectionClass()` or `ContainerBuilder::addObjectResource()` instead

Commits
-------

37e44939ef [DI][Config] Add & use ReflectionClassResource
2017-02-02 10:28:05 -08:00
Maxime Steinhausser
bf71776e20 [FrameworkBundle][Console] JsonDescriptor: Respect original output 2017-02-02 18:43:33 +01:00
Nicolas Grekas
7781082587 [DI] Deprecate underscore-services in YamlFileLoader 2017-02-02 16:30:45 +01:00
Fabien Potencier
87273d9f44 minor #21407 [WebServerBundle] Improved exception message (wouterj)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[WebServerBundle] Improved exception message

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

This is a quite minor one, but imo "guessing" is something that's optional. If I don't pass value X, a script will guess value X. However, in this case, the front controller file cannot be specified. It has to be one of the "guessed" file names. That's why I renamed "guessing" to "finding".

While doing this, I also added the possible file names in the exception message to ease fixing problems.

Commits
-------

df46188381 Improved exception message
2017-02-02 07:29:17 -08:00
Nicolas Grekas
caba97a62b feature #21455 [DI] Allow to count on lazy collection arguments (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Allow to count on lazy collection arguments

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21450#issuecomment-275931764
| License       | MIT
| Doc PR        | todo (with https://github.com/symfony/symfony-docs/issues/7336)

When using the new iterator feature of the DI component to lazy load collection, we always know the number of arguments in the collection (only the invalidBehavior set to `IGNORE_ON_INVALID_REFERENCE` may change this number). So we are able to generate and use a `RewindableGenerator` implementing `\Countable` by computing this value ahead.

So, in a service accepting `array|iterable`, like in the `GuardAuthenticationListener` (see #21450):

```php
class GuardAuthenticationListener implements ListenerInterface
{
    private $guardAuthenticators;

    /**
       * @param iterable|GuardAuthenticatorInterface[]  $guardAuthenticators   The authenticators, with keys that match what's passed to GuardAuthenticationProvider
       * @param LoggerInterface                         $logger                A LoggerInterface instance
    */
    public function __construct($guardAuthenticators, LoggerInterface $logger = null)
    {
          // ...
    }

    public function handle(GetResponseEvent $event)
    {
        if (null !== $this->logger) {
            $context = array()
            if (is_array($this->guardAuthenticators) || $this->guardAuthenticators instanceof \Countable) {
                $context['authenticators'] = count($this->guardAuthenticators);
            }
            $this->logger->debug('Checking for guard authentication credentials.', $context);
        }
        // ...
    }
}
```

we still keep the ability to call count without loosing the lazy load benefits.

Commits
-------

f23e460 [DI] Allow to count on lazy collection arguments
2017-02-02 15:11:42 +01:00
Nicolas Grekas
01a0250d49 bug #21485 [Process] Non ASCII characters disappearing during the escapeshellarg (GuillaumeVerdon)
This PR was submitted for the 3.2 branch but it was merged into the 2.7 branch instead (closes #21485).

Discussion
----------

[Process] Non ASCII characters disappearing during the escapeshellarg

If the LC_CTYPE is not set at UTF-8, the escapeshellarg() function will remove every non-ascii characters.

As it's usual in europe to have directories with non-ascii chars in their name (ex : ~/Vidéos) the function should throw an exception if we're trying to submit it an argument containing non-ascii param and the LC_CTYPE is not set to use UTF-8

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

I had this issue while using the lib ffmpeg and giving it a path like "~/Vidéos" the "é" chars was disappearing from the command giving a RuntimeException.

The problem was my LC_CTYPE that wasn't set properly, I believe an exception should be raised before the RuntimeException to warn the user of that behavior

Commits
-------

3779f3f [Process] Non ASCII characters disappearing during the escapeshellarg
2017-02-02 14:55:53 +01:00
GuillaumeVerdon
3779f3fbb9 [Process] Non ASCII characters disappearing during the escapeshellarg 2017-02-02 14:55:53 +01:00
Nicolas Grekas
55a34b7b51 Merge branch '3.2'
* 3.2:
  Add HEADER_FORWARDED to setTrustedHeaderName docs
  Fix phpDoc typo
  [FrameworkBundle][Console] JsonDescriptor: Respect original output
  Remove dead code
  Enable dump() in autoload-dev
  add missing functional Serializer test case
2017-02-02 14:49:58 +01:00
Nicolas Grekas
4fd91481c2 Merge branch '2.8' into 3.2
* 2.8:
  Add HEADER_FORWARDED to setTrustedHeaderName docs
  Fix phpDoc typo
  [FrameworkBundle][Console] JsonDescriptor: Respect original output
  Enable dump() in autoload-dev
2017-02-02 14:47:35 +01:00
Nicolas Grekas
0a6d3c6d00 Merge branch '2.7' into 2.8
* 2.7:
  Add HEADER_FORWARDED to setTrustedHeaderName docs
  Fix phpDoc typo
  [FrameworkBundle][Console] JsonDescriptor: Respect original output
  Enable dump() in autoload-dev
2017-02-02 14:38:20 +01:00
Nicolas Grekas
3ee1aa0160 minor #21501 [FrameworkBundle][Console] JsonDescriptor: Respect original output (ogizanagi)
This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle][Console] JsonDescriptor: Respect original output

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

I'm suggesting this one, because I recently pushed some changes to the descriptors, and of course, I'm not editing expected output fixtures by hand, but by dumping the real output to fixture files. But it's tiring to get false positive diffs when reviewing it. Descriptor tests already are painful enough 😅

This PR respects the way elements are actually output. If it's ok to you, I'll submit some other PRs to upper branches, because there are more issues regarding this (items order for instance).

If it causes too much troubles getting this in sync with upper branches, let's close this and never talk about it anymore 😄

Commits
-------

08dd70b [FrameworkBundle][Console] JsonDescriptor: Respect original output
2017-02-02 14:32:11 +01:00
Nicolas Grekas
b182088ca2 minor #21495 Add HEADER_FORWARDED to setTrustedHeaderName docs (pascal-hofmann)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #21495).

Discussion
----------

Add HEADER_FORWARDED to setTrustedHeaderName docs

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

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

b46276e Add HEADER_FORWARDED to setTrustedHeaderName docs
2017-02-02 14:27:35 +01:00
Pascal Hofmann
b46276e9b2 Add HEADER_FORWARDED to setTrustedHeaderName docs 2017-02-02 14:27:35 +01:00
Nicolas Grekas
0b57d17081 bug #21508 [DI] : Fix bad generation of proxy class when use overriden getter on class with constructor (jean-pasqualini)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] : Fix bad generation of proxy class when use overriden getter on class with constructor

[DI] : Fix bad generation of proxy class when use overriden getter on class with constructor

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

- [X] Add test fail
- [X] Fix bug
- [X] Run test pass

Commits
-------

2440b0f [DI] : Fix bad generation of proxy class when use overriden getter on class with constructor
2017-02-02 14:22:22 +01:00
Nicolas Grekas
37e44939ef [DI][Config] Add & use ReflectionClassResource 2017-02-02 14:15:15 +01:00
Nicolas Grekas
35a49fb577 feature #21408 [DI] Add ContainerBuilder::fileExists() for checking/tracking resource existence (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Add ContainerBuilder::fileExists() for checking/tracking resource existence

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

~~Finishes https://github.com/symfony/symfony/pull/20189~~ Adds a convenient `ContainerBuilder::fileExists()` method as suggested by Nicolas and use it to track resources in the FrameworkExtension, adding some missing ones.

Commits
-------

6b556b8 [DI] Add ContainerBuilder::fileExists()
2017-02-02 14:11:46 +01:00
Wouter J
df46188381 Improved exception message 2017-02-02 12:37:59 +01:00
Jean Pasqualini
2440b0f05d [DI] : Fix bad generation of proxy class when use overriden getter on class with constructor
- [X] Add test fail
- [X] Fix bug
- [X] Run test pass
2017-02-02 11:50:54 +01:00
Robin Chalas
6b556b8b9b [DI] Add ContainerBuilder::fileExists()
Update TwigExtension
2017-02-02 11:26:40 +01:00
Nicolas Grekas
fa9d24c5a2 minor #21503 [PropertyAccess] Fix phpDoc typo (scaytrase)
This PR was merged into the 2.7 branch.

Discussion
----------

[PropertyAccess] Fix phpDoc typo

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

Fix a phpDoc typo disallowing to manipulate the builder

Commits
-------

8e6cfa0 Fix phpDoc typo
2017-02-02 11:22:55 +01:00
Grégoire Paris
bde0efd01c
Implement PSR-11
Delegate lookup is optional and thus, not implemented.
2017-02-02 08:42:59 +01:00
Pavel Batanov
8e6cfa0cef Fix phpDoc typo 2017-02-02 08:03:53 +03:00
Nicolas Grekas
330b61fecb [Process] Accept command line arrays and per-run env vars, fixing signaling and escaping 2017-02-01 23:01:35 +01:00
Fabien Potencier
46daa359ea feature #21470 [Process] Deprecate not inheriting env vars + compat related settings (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Process] Deprecate not inheriting env vars + compat related settings

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

Turning compat on/off is not a feature in itself.

About env vars: if one has unwanted env vars, one will still be able to remove them explicitly for the command. From my experience, not having eg PATH or HTTP_PROXY, etc. is more problematic. I'd prefer people to care about setting/unsetting the environment vars **they know about**, rather than allowing them to start with no ENV and discover later that they missed setting some var.

Commits
-------

df14451a73 [Process] Deprecate not inheriting env vars + compat related settings
2017-02-01 13:16:10 -08:00
Fabien Potencier
1b2801591e feature #21494 [DI] Deprecate autowiring-types in favor of aliases (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Deprecate autowiring-types in favor of aliases

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #21351, #19970, ~~#18040~~, ~~#17783~~
| License       | MIT
| Doc PR        | symfony/symfony-docs#7445

https://github.com/symfony/symfony/pull/21494/files?w=1
This PR deprecates autowiring-types and replaces them by plain aliases.
ping @dunglas @weaverryan

Eg instead of
```xml
<service id="annotations.reader" class="Doctrine\Common\Annotations\AnnotationReader" public="false">
    <autowiring-type>Doctrine\Common\Annotations\Reader</autowiring-type>
</service>
```

just do:
```xml
<service id="annotations.reader" class="Doctrine\Common\Annotations\AnnotationReader" public="false" />
<service id="Doctrine\Common\Annotations\Reader" alias="annotations.reader" public="false" />
```

Commits
-------

b11d391cb7 [DI] Deprecate autowiring-types in favor of aliases
2017-02-01 12:54:06 -08:00
Fabien Potencier
29db096b0b minor #21492 [DI] Deduplicate resources while adding them (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Deduplicate resources while adding them

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

Since the string cast of resources is already used to deduplicate them, let's do it earlier. This can only decrease memory usage.

Commits
-------

04853fc5c3 [DI] Deduplicate resource while adding them
2017-02-01 11:11:51 -08:00
Maxime Steinhausser
08dd70b507 [FrameworkBundle][Console] JsonDescriptor: Respect original output 2017-02-01 19:43:31 +01:00
Nicolas Grekas
b11d391cb7 [DI] Deprecate autowiring-types in favor of aliases 2017-02-01 19:42:39 +01:00
Fabien Potencier
65f1eb8045 minor #21493 [DoctrineBridge] Remove dead code in DoctrineOrmExtension (yceruto)
This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes #21493).

Discussion
----------

[DoctrineBridge] Remove dead code in DoctrineOrmExtension

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

After optimization in #20312 and #18359

Commits
-------

0cd8bf82bc Remove dead code
2017-02-01 07:55:07 -08:00
Yonel Ceruto
0cd8bf82bc Remove dead code 2017-02-01 07:55:07 -08:00
Nicolas Grekas
4b8ac468d4 minor #21491 Enable dump() in autoload-dev (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

Enable dump() in autoload-dev

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

I miss `dump()` badly when working on Symfony itself.

Commits
-------

89e0088 Enable dump() in autoload-dev
2017-02-01 15:45:38 +01:00
Nicolas Grekas
b4ff1c8767 minor #21488 [DI] Save a ReflectionClass instantiation in AutowirePass (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Save a ReflectionClass instantiation in AutowirePass

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

No behavioral change, just a small refacto that I'm needing for two different PRs I'm working on - will make reviewing them easier also.
Best reviewed by ignoring whitespaces.

Commits
-------

b893c72 [DI] Save a ReflectionClass instanciation in AutowirePass
2017-02-01 15:23:38 +01:00
Nicolas Grekas
04853fc5c3 [DI] Deduplicate resource while adding them 2017-02-01 14:00:02 +01:00
Nicolas Grekas
89e0088c57 Enable dump() in autoload-dev 2017-02-01 13:47:47 +01:00
Nicolas Grekas
b893c72070 [DI] Save a ReflectionClass instanciation in AutowirePass 2017-02-01 13:10:11 +01:00
Nicolas Grekas
fe55075c0e Merge branch '2.8' into 3.2
* 2.8:
  add missing functional Serializer test case
2017-02-01 11:33:06 +01:00
Nicolas Grekas
6316f3477f minor #21486 [FrameworkBundle] add missing functional Serializer test case (xabbuh)
This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle] add missing functional Serializer test case

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

This is needed to make the test introduced in #21370. It basically backports the functional test config as introduced by @dunglas in #20480.

Commits
-------

24243ac add missing functional Serializer test case
2017-02-01 11:10:25 +01:00
Christian Flothmann
24243ace89 add missing functional Serializer test case 2017-02-01 10:59:03 +01:00
Robin Chalas
cd6422ae73
[SecurityBundle] Lazy load authentication providers 2017-02-01 00:43:39 +01:00
Robin Chalas
b8a23ded63
[Security][Guard] Lazy load authenticators 2017-02-01 00:43:39 +01:00
Fabien Potencier
b3b3dac81b minor #21482 [FrameworkBundle] Fix tests (dunglas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle] Fix tests

| 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

Travis is red because of the new test introduced in #21370. This should make it green again.

Commits
-------

1bf451cc70 [FrameworkBundle] Fix tests
2017-01-31 15:38:45 -08:00
Kévin Dunglas
1bf451cc70
[FrameworkBundle] Fix tests 2017-02-01 00:11:01 +01:00
Nicolas Grekas
2fb4fb93f8 Merge branch '3.2'
* 3.2:
  [Console] Fix too strict test
  [FrameworkBundle] Execute the PhpDocExtractor earlier
  [validator] Updated croatian translation
  Update DebugHandlersListener.php
  ignore invalid cookies expires date format
  [Console] SfStyleTest: Remove COLUMN env on tearDown
  [TwigBundle] Fix the name of the cache warming test class
  [Console] Fix TableCell issues with decoration
  Add missing pieces in the upgrade guide to 3.0
2017-01-31 22:52:27 +01:00
Nicolas Grekas
5b9e75e4a0 Merge branch '2.8' into 3.2
* 2.8:
  [Console] Fix too strict test
  [FrameworkBundle] Execute the PhpDocExtractor earlier
  [validator] Updated croatian translation
  ignore invalid cookies expires date format
  [TwigBundle] Fix the name of the cache warming test class
  [Console] Fix TableCell issues with decoration
  Add missing pieces in the upgrade guide to 3.0
2017-01-31 22:49:23 +01:00
Nicolas Grekas
9cf01d8a3a Merge branch '2.7' into 2.8
* 2.7:
  [Console] Fix too strict test
  [validator] Updated croatian translation
  ignore invalid cookies expires date format
  [TwigBundle] Fix the name of the cache warming test class
  [Console] Fix TableCell issues with decoration
  Add missing pieces in the upgrade guide to 3.0
2017-01-31 22:48:58 +01:00
Fabien Potencier
09ec851d1a minor #21466 [DI] Remove usages of ClassExistenceResource (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Remove usages of ClassExistenceResource

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

As discussed in #21452 (see last comments)

Commits
-------

ec8f1ad453 [DI] Remove usages of ClassExistenceResource
2017-01-31 13:44:19 -08:00
Fabien Potencier
de1ba1c625 minor #21477 [Console] Fix too strict test (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix too strict test

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

required to make #21474 green in cross versions tests

Commits
-------

ee4b3e2712 [Console] Fix too strict test
2017-01-31 13:36:36 -08:00
Fabien Potencier
991e062a91 feature #21451 [SecurityBundle] Lazy load request matchers in FirewallMap (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[SecurityBundle] Lazy load request matchers in FirewallMap

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

Commits
-------

5b72cf6950 [Security] Lazy load request matchers
2017-01-31 13:33:24 -08:00
Robin Chalas
5b72cf6950
[Security] Lazy load request matchers 2017-01-31 21:20:22 +01:00