Commit Graph

30890 Commits

Author SHA1 Message Date
Fabien Potencier
20b19b0650 updated CHANGELOG for 3.3.0-BETA1 2017-05-01 11:30:10 -07:00
Fabien Potencier
33d4bce1f9 Merge branch '3.2'
* 3.2:
  fixed tests
  fixed merge
  Fix minor phpdoc mismatches with the code(detected by phan)
  [Asset] Starting slash should indicate no basePath wanted
  [Security] Fix phpdoc logout listener
  [EventDispatcher] fix getting priorities of listeners during dispatch
  Add iconv extension to suggested dependencies
  Fix minor typo in the main README.md
  Allow Upper Case property names in ObjectNormalizer
  [EventDispatcher] fix: unwrap listeners for correct info
2017-05-01 08:01:29 -07:00
Fabien Potencier
c7a7170e0e fixed tests 2017-05-01 07:58:48 -07:00
Fabien Potencier
9c610ee1a2 fixed merge 2017-05-01 07:56:26 -07:00
Fabien Potencier
824dc8ba5f Merge branch '2.8' into 3.2
* 2.8:
  Fix minor phpdoc mismatches with the code(detected by phan)
  [Asset] Starting slash should indicate no basePath wanted
  [Security] Fix phpdoc logout listener
  Add iconv extension to suggested dependencies
  Fix minor typo in the main README.md
  Allow Upper Case property names in ObjectNormalizer
  [EventDispatcher] fix: unwrap listeners for correct info
2017-05-01 07:55:58 -07:00
Fabien Potencier
6000fafa27 Merge branch '2.7' into 2.8
* 2.7:
  Fix minor phpdoc mismatches with the code(detected by phan)
  [Asset] Starting slash should indicate no basePath wanted
  [Security] Fix phpdoc logout listener
  Fix minor typo in the main README.md
2017-05-01 07:31:55 -07:00
Fabien Potencier
3c9a7e4dc5 minor #22591 [Profiler] DataCollector: Remove unused static property (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Profiler] DataCollector: Remove unused static property

| 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

Unless I missed something, any usage of this property were removed in https://github.com/symfony/symfony/pull/21638.

Commits
-------

96743e69ad [Profiler] DataCollector: Remove unused static property
2017-05-01 07:29:48 -07:00
Fabien Potencier
2d88787b1f feature #22530 Making tags under _defaults always apply (weaverryan)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Making tags under _defaults always apply

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

Obviously, things under `_defaults` are applied to all services in that file. However, tags was an exception: it was *not* applied unless you have `inherit_tags`. The correct behavior is subjective, but after talking about it today, we (mostly) decided that tags *should* always apply. This does exactly that.

One side-effect (explained in the commit message) is that if you have a parent and child service both in the same file, the tag from `_defaults` is applied twice. I think that makes sense, and at some point, we can't protect the users from their own configuration :). This kind of "weird" behavior is likely not a problem, as compiler passes now handle multiple tags well AND it only affects a case where the user has added tags to `_defaults` *and* is using parent-child definitions. That's quite a strange mixture of conditions :).

Cheers!

Commits
-------

037a782b91 Making tags under _defaults always apply and removing inherit_tags entirely
2017-05-01 07:25:12 -07:00
Ryan Weaver
037a782b91 Making tags under _defaults always apply and removing inherit_tags entirely
Now that inherit_tags has been removed, 3.3 has the same functionality as 3.2: tags
are *never* cascaded from parent to child (but you tags do inherit from defaults
to a service and instanceof to a service).
2017-05-01 09:36:02 -04:00
Fabien Potencier
7010a7a76b feature #22590 [Lock] remove the component from 3.3 (fabpot)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Lock] remove the component from 3.3

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

As decided in #22580, we will read the Lock component in 3.4.

Commits
-------

37ec869511 [Lock] remove the component from 3.3
2017-04-30 09:40:33 -07:00
Maxime Steinhausser
96743e69ad [Profiler] DataCollector: Remove unused static property 2017-04-30 18:37:23 +02:00
Fabien Potencier
37ec869511 [Lock] remove the component from 3.3 2017-04-30 08:55:30 -07:00
Christophe Coevoet
82a6a35446 bug #22585 [Security] json login listener: ensure a json response is sent on bad request (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Security] json login listener: ensure a json response is sent on bad request

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

I would have simply recommended to set the proper format when declaring the route:

```yml
# routing.yml
api_login:
    path: /login
    defaults: { _format: json }
```

but, since https://github.com/symfony/symfony/pull/22477 has been merged, and considering https://github.com/symfony/symfony/pull/22477#issuecomment-295897629:

> my point above regarding checking the content type is so that one could use form_login and json_login in parallel on the same routes and within the same firewall

we may consider setting the request format to json when throwing the `BadRequestHttpException`, so used conjointly with the TwigBundle, the exception is rendered using the `exception.json.twig` template.

ping @lsmith77

(An alternative would be to check the Accept header to set the request format to json if it's the preferred one instead of doing it each time we throw the exception. But Symfony never used such content negotiation AFAIK, and I think it's safe enough to assume someone sending json is expecting json as ouput for exceptions.)

Commits
-------

4427cf9157 [Security] json login listener: ensure a json response is sent on bad request
2017-04-30 14:43:24 +02:00
Nicolas Grekas
5edbc13552 bug #22581 [DI] Fix invalid callables dumped for ArgumentInterface objects (nicolas-grekas, iltar)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Fix invalid callables dumped for ArgumentInterface objects

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

Follow up of #22511, from @iltar:

> Currently, when having a service definition which has more than 1 usage of that service, it will put the argument in `$a` for example. By doing so, it will also use `$a` in the callable of the `ServiceLocator`, which result in an undefined variable `$a`.

> I managed to trigger this with the translator service, where I have my own loader, that I add for NL and EN, causing 2 method calls to turn the direct getter into a variable. I've added 2 test cases, 1 with only 1 method call and 1 with 2 method calls.

Commits
-------

f81c577 [DI] Test references inside ServiceLocator are not inlined
8783602 [DI] Fix invalid callables dumped for ArgumentInterface objects
2017-04-30 12:56:25 +02:00
Maxime Steinhausser
4427cf9157 [Security] json login listener: ensure a json response is sent on bad request 2017-04-30 11:12:10 +02:00
Iltar van der Berg
f81c57755d [DI] Test references inside ServiceLocator are not inlined 2017-04-29 20:26:40 +02:00
Nicolas Grekas
8783602946 [DI] Fix invalid callables dumped for ArgumentInterface objects 2017-04-29 20:26:39 +02:00
Nicolas Grekas
b9e19f63c3 minor #22582 Fix tests (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Fix tests

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

Commits
-------

b6948dd Fix tests
2017-04-29 20:14:32 +02:00
Robin Chalas
b6948ddb34 Fix tests 2017-04-29 19:49:33 +02:00
Fabien Potencier
8872833c5d feature #22527 [DI] Throw useful exception on bad XML argument tags (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Throw useful exception on bad XML argument tags

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

I still think that the feature request in #22525 would make things better.
But at least, let's make thing fail loudly, instead of silently today, with the associated usual wtfs :)

Commits
-------

91828ecd17 [DI] Throw useful exception on bad XML argument tags
2017-04-29 09:33:57 -07:00
Nicolas Grekas
91828ecd17 [DI] Throw useful exception on bad XML argument tags 2017-04-29 18:31:27 +02:00
Fabien Potencier
c84ee65b99 minor #22453 Fix minor phpdoc mismatches with the code(detected by phan) (TysonAndre)
This PR was squashed before being merged into the 2.7 branch (closes #22453).

Discussion
----------

Fix minor phpdoc mismatches with the code(detected by phan)

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

Fix minor mismatches between phpdoc and the type of the code itself, detected by etsy/phan (Prevent confusion in the future)
The actual return types of a few functions have changed from int to bool where preg_match or `&` was used.
Fix optional param before required param in src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

The config used and the rest of the output is at https://gist.github.com/TysonAndre/91bed0e16583301f1e6e5cc2a4807081 (Uses some patches to etsy/phan that weren't merged to master yet)

Commits
-------

12f1239565 Fix minor phpdoc mismatches with the code(detected by phan)
2017-04-29 08:58:47 -07:00
Tyson Andre
12f1239565 Fix minor phpdoc mismatches with the code(detected by phan) 2017-04-29 08:58:46 -07:00
Fabien Potencier
35608f57d5 minor #22477 [Security] add Request type json check in json_login (lsmith77)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Security] add Request type json check in json_login

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

follow up to https://github.com/symfony/symfony/pull/22425 to limit the `UsernamePasswordJsonAuthenticationListener` to only requests with appropriate JSON content type.

I am not entirely happy with this implementation but mostly because Symfony out of the box only provides very limited content type negotiation. I guess anyone that wants to tweak the content negotiation will simply need to ensure the Request::$format is set accordingly before the code is triggered.

Commits
-------

045a36b303 add Request type json check in json_login
2017-04-29 08:53:46 -07:00
Fabien Potencier
5863e4b6a1 minor #22555 [Serializer] Add missing normalizer options constants (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Serializer] Add missing normalizer options constants

| Q             | A
| ------------- | ---
| Branch?       | master (3.3)
| Bug fix?      | not really
| New feature?  | yesish, but for 3.3 as those options were added on this branch and not released yet
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22537#discussion_r113719848
| License       | MIT
| Doc PR        | N/A

As seen in https://github.com/symfony/symfony/pull/22537#discussion_r113719848.

@dunglas : I'm not sure about the exposing the `key_type` option as a constant in `ArrayDenormalizer`/`AbstractObjectNormalizer`, as it looks more or less like a detail of the AbstractObjectNormalizer implementation, but anyway it should be in 3.2 if we add it, so I haven't included it here.
However, I wonder if this option shouldn't directly accept a string too, rather than just a `Symfony\Component\PropertyInfo\Type` instance if we want to consider this option "public"?

Commits
-------

b0c414f2c8 [Serializer] Add missing normalizer options constants
2017-04-29 08:51:18 -07:00
Fabien Potencier
1cef186dfe feature #22537 [Serializer] Allow to pass csv encoder options in context (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Serializer] Allow to pass csv encoder options in context

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

CSV contents typically are provided by one or many third-parties, not always allowing you to get control over the provided format. In case you need to import csv files with different formats, either you have to instantiate a decoder yourself/inject it instead of the main serializer instance, either you need another serializer instance with a differently configured csv encoder registered within.

This PR allows to configure any encoder option through the context, so you can keep injecting and using the same serializer instance.

Commits
-------

10a76aac15 [Serializer] Allow to pass csv encoder options in context
2017-04-29 08:50:00 -07:00
Fabien Potencier
07fc0602e1 bug #22550 Allow Upper Case property names in ObjectNormalizer (insekticid)
This PR was merged into the 2.8 branch.

Discussion
----------

Allow Upper Case property names in ObjectNormalizer

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

Same problem that has been fixed here https://github.com/symfony/symfony/pull/22265
and here https://github.com/api-platform/core/pull/1037

ObjectNormalizer returns $id instead of $Id. It is bad naming convention, but is possible

```php
class Entity {
    protected $Id;

    public function getId()
    {
        return $this->Id;
    }
}
```

Commits
-------

b2b4faa3c0 Allow Upper Case property names in ObjectNormalizer
2017-04-29 08:44:59 -07:00
Fabien Potencier
04e48bd120 minor #22557 [VarDumper] Add iconv dependency (julienfalque)
This PR was merged into the 2.8 branch.

Discussion
----------

[VarDumper] Add iconv dependency

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

Alternative to #20927.

I still think adding `@requires extension iconv` to the related tests would be nice though: on some PHP setups the iconv extension is not available by default, those tests will fail and result in red errors when running the test suite, even when working on something unrelated. The test would still run on CI so it's fine IMO.

Should I add `ext-iconv` and/or `symfony/polyfill` to `require-dev`?

/cc @nicolas-grekas

Commits
-------

13f17079ef Add iconv extension to suggested dependencies
2017-04-29 08:42:18 -07:00
Fabien Potencier
460fcbf23b bug #22569 [Security] Handle bad request format in json auth listener (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Security] Handle bad request format in json auth listener

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

In https://github.com/symfony/symfony/pull/22034, I wondered myself if we shouldn't throw a dedicated exception to handle bad formatted requests and give more inputs to the client by returning a 400 response with an explicit message.

~~Here is a suggestion, introducing a new `BadRequestFormatException` and using it in `UsernamePasswordJsonAuthenticationListener` whenever there is no custom failure handler set (but someone using its own handler should be able to treat the failure properly too).~~

As discussed with @chalasr , it seems better to directly throw a `BadRequestHttpException` as it's actually out of the whole security process. PR updated.

Commits
-------

93a8cb9cd4 [Security] Handle bad request format in json auth listener
2017-04-29 08:39:09 -07:00
Fabien Potencier
288d55f620 bug #22551 [Process] Ecaping of CLI arguments containing slashes on Windows (maryo)
This PR was squashed before being merged into the 3.3-dev branch (closes #22551).

Discussion
----------

[Process] Ecaping of CLI arguments containing slashes on Windows

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

Actually only the first argument - the command needs to be escaped but that would need another condition. I think it should be OK.

Commits
-------

0d073128de [Process] Ecaping of CLI arguments containing slashes on Windows
2017-04-29 08:36:13 -07:00
maryo
0d073128de [Process] Ecaping of CLI arguments containing slashes on Windows 2017-04-29 08:36:12 -07:00
Fabien Potencier
89979ca1eb feature #22563 Not allowing autoconfigure, instanceofConditionals or defaults for ChildDefinition (weaverryan)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Not allowing autoconfigure, instanceofConditionals or defaults for ChildDefinition

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

This PR *prohibits* using `autoconfigure`, `_instanceof` and `_defaults` for ChildDefinition.

Additionally, I added many "integration" test cases: we need to test and prove all edge cases. These are in the `integration/` directory: the `main.yml` file is parsed and compared to `expected.yml`. Both are in YAML to ease comparing the before/after. We need to check these out and make sure they're right and we're not missing anything else.

This PR removes MANY of the "wtf" cases, but there are still 4 that I know of... and of course they all deal with parent-child stuff :).

A) [MAJOR] [autoconfigure_parent_child_tags](https://github.com/symfony/symfony/pull/22563/files#diff-fd6cf15470c5abd40156e4e7dc4e7f6d) `instanceof` tags from autoconfigure are NEVER applied to the child (you can't set `autoconfigure` directly on a Child, but you still can set it on a parent and inherit it... sneaky). We could throw an Exception I suppose to prevent this `autoconfigure` from cascading from parent to child... but it's tricky due to `instanceof`.

B( [MAJOR] [instanceof_parent_child](https://github.com/symfony/symfony/pull/22563/files#diff-14666e9a25322d44b3c2c583b6814dc2) `instanceof` tags that are applied to the parent, are not applied to the child. Again, you can't set `instanceof` directly on a Child, but you *can* set it on a parent, and have that cascade to the child. Like before, we could maybe throw an exception to prevent this.

C) [MINOR] ([autoconfigure_child_not_applied](https://github.com/symfony/symfony/pull/22563/files#diff-3372a1dcaf3af30d14a7d0a6c8bfa988))  automatic `instanceof` will not be applied to the child when the parent class has a different (non-instanceof-ed) class. If we could throw an exception for (A), then it would cover this too.

D) `_tags` from defaults are never used (unless you have inherit_tags) - fixed in #22530

A, B & C are effectively caused by there being a "sneaky" way to re-enable `autoconfigure` and `instanceof` for ChildDefinition... which opens up wtf cases.

## Wait, why not support `_defaults`, `autoconfigure` and `_instanceof` for child definitions?

1 big reason: reduction of wtf moments where we arbitrarily decide override logic. PLUS, since `_defaults`, `instanceof` and `autoconfigure` *are* applied to parent definitions, in practice (other than tags), this makes no difference: the configuration will still pass from parent down to child.

Also, using parent-child definitions is already an edge case, and this *simply* prevents *just* those services from using the new features.

## Longer reasons why

The reason behind this is that parent-child definitions are a different mechanism for "inheritance"
than `_instanceof` and `_defaults`... creating some edge cases when trying to figure out which settings "win". For example:

```yml
# file1.yml
services:
    _defaults:
        public: false

    ChildService:
        parent: parent_service

# file2.yml
services:
    _defaults:
        public: true

    ParentService: ~
```

Is `ChildDefinition` `public: true` (so the parent
overrides the child, even though it only came from _defaults) or `public: false` (where
the child wins... even though it was only set from its _defaults)?

Or, if ParentService is explicitly set to `public: true`, should that override the `public: false` of ChildService (which it got from its `_defaults`)? On one hand, ParentService is being explicitly
set. On the other hand, ChildService is explicitly in a file settings `_defaults` `public: false`
There's no correct answer.

There are also problems with `_instanceof`. The importance goes:

> defaults < instanceof < service definition

But how do parent-child relationships fit into that? If a child has public: false
from an _instanceof, but the parent explicitly sets public: true, which wins? Should
we assume the parent definition wins because it's explicitly set? Or would the
_instanceof win, because that's being explicitly applied to the child definition's
class by an _instanceof that lives in the same file as that class (whereas the parent
definition may live in a different file).

Because of this, @nicolas-grekas and I (we also talked a bit to Fabien) decided that
the complexity was growing too much. The solution is to not allow any of these
new feature to be used by ChildDefinition objects. In other words, when you want some
sort of "inheritance" for your service, you should *either* giving your service a
parent *or* using defaults and instanceof. And instead of silently not applying
defaults and instanceof to child definitions, I think it's better to scream that it's
not supported.

Commits
-------

a943b96d42 Not allowing autoconfigure, instanceofConditionals or defaults for ChildDefinition
2017-04-29 08:25:33 -07:00
Fabien Potencier
8806628d43 bug #22579 [Console][HttpKernel] Avoid reflection-based registration for command public services (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Console][HttpKernel] Avoid reflection-based registration for command public services

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

By mapping commands ids by their alias in `console.command.ids` (even if the alias is not registered in the container for public services), then skipping reflection if the predictable alias exists as a key of `console.command.ids`.

Please note that the whole command service registration process is far from ideal.
I'm working on changing this for 3.4 in a transparent way regarding end users, leveraging PSR-11 to make the console component DI friendly, allowing to register commands as true private services (no more public aliases) and providing laziness for those.

Commits
-------

6c1b384b75 Avoid reflection-based registration for command public services
2017-04-29 08:24:25 -07:00
Christophe Coevoet
ceabf11b64 bug #22564 Fixing problem where _defaults set to null was seen as a service (weaverryan)
This PR was squashed before being merged into the 3.3-dev branch (closes #22564).

Discussion
----------

Fixing problem where _defaults set to null was seen as a service

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

```yml
services:
    _defaults:
```

If you leave `_defaults` empty (i.e. null), you got a bad error before. Now it's better :)

Before:
>The definition for "_defaults" has no class. If you intend to inject this service dynamicall
  y at runtime, please mark it as synthetic=true. If this is an abstract definition solely use
  d by child definitions, please add abstract=true, otherwise specify a class to get rid of th
  is error.

After:
> Service "_defaults" key must be an array, "NULL" given in "/path/to/services.yml"

Commits
-------

4b7e148a9b Fixing problem where _defaults set to null was seen as a service
2017-04-29 12:32:06 +02:00
Ryan Weaver
4b7e148a9b Fixing problem where _defaults set to null was seen as a service 2017-04-29 12:32:04 +02:00
Robin Chalas
6c1b384b75 Avoid reflection-based registration for command public services 2017-04-29 11:46:23 +02:00
Fabien Potencier
c669b88403 bug #22528 [Asset] Starting slash should indicate no basePath wanted (weaverryan)
This PR was squashed before being merged into the 2.7 branch (closes #22528).

Discussion
----------

[Asset] Starting slash should indicate no basePath wanted

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

**Important** View the second commit for an accurate diff. The first commit just renames some strings in a test for clarity.

When we moved `PathPackage` from `Templating` to `Asset`, we actually changed its behavior. Assume that we're deployed under a `/subdir` subdirectory:

**Before** `{{ asset('/main.css') }}` would *not* have the base path prefixed -> `/main.css`

**After** `{{ asset('/main.css') }}` *does* have the base path prefixed -> `/subdir/main.css`

3adff11d72/src/Symfony/Component/Templating/Asset/PathPackage.php (L61-L63)

This PR simply reverses that, to the *previous* behavior. This *is* a BC break... and also arguably a bug fix :). Interestingly, when we changed the behavior the first time (i.e. broke BC), I don't think that anyone noticed. It should only affect users deployed under a subdirectory.

Why do I care? I'm using the new `JsonManifestVersionStrategy` with a library that is outputting paths that *already* include my subdirectory:

```json
{
    "build/main.css": "/subdir/build/main.abc123.css"
}
```

So, I do not want Symfony to detect the `/subdir` and apply it a second time.

Commits
-------

3cc096b540 [Asset] Starting slash should indicate no basePath wanted
2017-04-28 16:08:26 -07:00
Ryan Weaver
3cc096b540 [Asset] Starting slash should indicate no basePath wanted 2017-04-28 16:08:24 -07:00
Ryan Weaver
a943b96d42 Not allowing autoconfigure, instanceofConditionals or defaults for ChildDefinition
Also, not allowing arguments or method calls for autoconfigure. This is a safety
mechanism, since we don't have merging logic. It will allow us to add this in the
future if we want to.

The reason is that parent-child definitions are a different mechanism for "inheritance"
than instanceofConditionas and defaults... creating some edge cases when trying to
figure out which settings "win". For example:

Suppose a child and parent definitions are defined in different YAML files. The
child receives public: false from its _defaults, and the parent receives public: true
from its _defaults. Should the final child definition be public: true (so the parent
overrides the child, even though it only came from _defaults) or public: false (where
the child wins... even though it was only set from its _defaults). Or, if the parent
is explicitly set to public: true, should that override the public: false of the
child (which it got from its _defaults)? On one hand, the parent is being explicitly
set. On the other hand, the child is explicitly in a file settings _defaults public
to false. There's no correct answer.

There are also problems with instanceof. The importance goes:
  defaults < instanceof < service definition

But how does parent-child relationships fit into that? If a child has public: false
from an _instanceof, but the parent explicitly sets public: true, which wins? Should
we assume the parent definition wins because it's explicitly set? Or would the
_instanceof win, because that's being explicitly applied to the child definition's
class by an _instanceof that lives in the same file as that class (whereas the parent
definition may live in a different file).

Because of this, @nicolas-grekas and I (we also talked a bit to Fabien) decided that
the complexity was growing too much. The solution is to not allow any of these
new feature to be used by ChildDefinition objects. In other words, when you want some
sort of "inheritance" for your service, you should *either* giving your service a
parent *or* using defaults and instanceof. And instead of silently not applying
defaults and instanceof to child definitions, I think it's better to scream that it's
not supported.
2017-04-28 17:09:21 -04:00
Fabien Potencier
f8133cbd4e bug #22565 If an instanceof does not exist, throw an exception (weaverryan)
This PR was merged into the 3.3-dev branch.

Discussion
----------

If an instanceof does not exist, throw an exception

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

Before, it was possible to add an `instanceof` with a non-existent class/interface. Now it throws an exception, but ONLY for conditionals set directly on a Definition: we still allow for global "automatic" instanceof definitions to be set on the `ContainerBuilder`. I'm not sure if that's correct... it makes life easier for bundler maintainers. If we also strictly validated the existence of "automatic" instanceof's, then (for example) in `FrameworkExtension`, we would need to do an `if interface_exists()` around most of the `registerForAutoconfiguration()` calls.

Commits
-------

ab0fd6e663 If a (non-global) instanceof does not exist, throw an exception
2017-04-28 13:30:07 -07:00
Ryan Weaver
ab0fd6e663 If a (non-global) instanceof does not exist, throw an exception 2017-04-28 14:07:50 -04:00
Fabien Potencier
af15ead255 minor #22574 [Security] Fix phpdoc logout listener (ro0NL)
This PR was squashed before being merged into the 2.7 branch (closes #22574).

Discussion
----------

[Security] Fix phpdoc logout listener

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Separated from #22572

Commits
-------

e843924c03 [Security] Fix phpdoc logout listener
2017-04-28 10:36:26 -07:00
Roland Franssen
e843924c03 [Security] Fix phpdoc logout listener 2017-04-28 10:36:25 -07:00
Fabien Potencier
143b5ff26a bug #22570 Fixes twig bundle project root dir discovery (Pierre Rineau)
This PR was squashed before being merged into the 3.3-dev branch (closes #22570).

Discussion
----------

Fixes twig bundle project root dir discovery

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

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

TwigBundle ExtensionPass uses a directory lookup algorithm to find the composer.json file. When working under open_basedir restrictions, if the project root folder is not allowed PHP runtime to read, the composer.json will never be found, throwing PHP notices along the way and ending up using the filesystem root instead.

Since that 3.3 introduced the kernel getProjectRoot() method and kernel.project_dir variable, the TwigBundle can now leverage it, in order to get more consistent, and allow site builders to override the getProjectRoot() kernel method, hence bypass the open_basedir restrictions in reliable and safe way.

Commits
-------

3cb2e5b7dd Fixes twig bundle project root dir discovery
2017-04-28 10:16:56 -07:00
Pierre Rineau
3cb2e5b7dd Fixes twig bundle project root dir discovery 2017-04-28 10:16:50 -07:00
Nicolas Grekas
c590e85c1b bug #22568 [EventDispatcher] fix getting priorities of listeners during dispatch (dmaicher)
This PR was merged into the 3.2 branch.

Discussion
----------

[EventDispatcher] fix getting priorities of listeners during dispatch

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

The WebProfiler collects listener info during dispatching the `kernel.terminate` event which caused issues while retrieving priorities as the wrappers are registered instead of the real listeners.

Commits
-------

79b71c0 [EventDispatcher] fix getting priorities of listeners during dispatch
2017-04-28 14:55:39 +02:00
Maxime Steinhausser
93a8cb9cd4 [Security] Handle bad request format in json auth listener 2017-04-28 14:46:31 +02:00
David Maicher
79b71c069d [EventDispatcher] fix getting priorities of listeners during dispatch 2017-04-28 13:59:53 +02:00
Julien Falque
13f17079ef
Add iconv extension to suggested dependencies 2017-04-28 08:26:40 +02:00
Nicolas Grekas
e0ff6e06c9 minor #22559 Fix minor typo in the main README.md (ogizanagi)
This PR was merged into the 2.7 branch.

Discussion
----------

Fix minor typo in the main README.md

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

8ea38b5 Fix minor typo in the main README.md
2017-04-27 15:30:40 -04:00