Commit Graph

29567 Commits

Author SHA1 Message Date
Maxime Steinhausser
f23e460fad [DI] Allow to count on lazy collection arguments 2017-01-31 10:40:15 +01:00
Nicolas Grekas
ec8f1ad453 [DI] Remove usages of ClassExistenceResource 2017-01-31 00:00:52 +01:00
Fabien Potencier
f4693be339 bug #21370 [FrameworkBundle] Execute the PhpDocExtractor earlier (GuilhemN)
This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes #21370).

Discussion
----------

[FrameworkBundle] Execute the PhpDocExtractor earlier

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes, but safer to apply on master
| New feature?  | no
| BC breaks?    | is changing a priority a bc break?
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/21367
| License       | MIT
| Doc PR        |

Fixes https://github.com/symfony/symfony/issues/21367.

> I wonder if this is logical to execute the PhpDocExtractor after the ReflectionExtractor: when you use phpdocs it's because they are more precise than php type hints.
This causes an issue in NelmioApiDocBundle, for example you can't use int[] with a setter as the type mixed[] will be returned instead of int[].
>
> ~~Would you accept bumping its priority to -999?~~

This PR changes the priority of the `ReflectionExtractor` to `-1002` to make sure it is executed after the `PhpDocExtractor`.

Commits
-------

0425e0549b [FrameworkBundle] Execute the PhpDocExtractor earlier
2017-01-30 14:26:58 -08:00
Guilhem N
0425e0549b [FrameworkBundle] Execute the PhpDocExtractor earlier 2017-01-30 14:26:57 -08:00
Fabien Potencier
2183f98f54 feature #20973 [DI] Add getter injection (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Add getter injection

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

Getter overriding by the container will allow a new kind of dependency injection which enables easier laziness and more immutable classes, by not requiring any corresponding setter. See linked issue for more.

This is WIP:
- [x] wire the concept
- [x] dump anonymous classes with PhpDumper
- [x] generate at runtime in ContainerBuilder::createService
- [x] tests
- [x] make it work on PHP 5

Commits
-------

cb498580d1 [DI] Add getter injection
2017-01-30 11:43:35 -08:00
Rob Frawley 2nd
d5746ecfd2
fix directory resource considers same timestamp not fresh 2017-01-30 13:31:59 -05:00
Fabien Potencier
a1dedef2aa minor #21449 [Validator] Added missing Croatian translation (aubx)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #21449).

Discussion
----------

[Validator] Added missing Croatian translation

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

Commits
-------

5cd7931c24 [validator] Updated croatian translation
2017-01-30 08:21:29 -08:00
Josip Kruslin
5cd7931c24 [validator] Updated croatian translation 2017-01-30 08:21:29 -08:00
Fabien Potencier
b465634a55 minor #21461 [HttpFoundation] Mark more methods as @final (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[HttpFoundation] Mark more methods as `@final`

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

Follow up of #19734 (ping @GuilhemN)

Commits
-------

84a664f929 [HttpFoundation] Mark more methods as `@final`
2017-01-30 08:06:19 -08:00
Fabien Potencier
5378bc9b55 minor #21424 [FrameworkBundle] Revert AbstractDescriptorTest output trimming (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle] Revert AbstractDescriptorTest output trimming

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no, but fixes an annoying/unhelping test output and fixes false positives
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21129/files#diff-0e52187cbf1067a310538287da74ddb5R178
| License       | MIT
| Doc PR        | N/A

#### Before output when having a failing test, for instance, in a `TextDescriptor` fixture:

```diff
There was 1 failure:

1) Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\TextDescriptorTest::testDescribeContainerDefinitionWhichIsAnAlias with data set #1 (Symfony\Component\DependencyInjection\Alias Object (...), ' // This serv...------', Symfony\Component\DependencyInjection\ContainerBuilder Object (...), array('alias_2'))
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-' // This service is an alias for the service service_2 Information for Service "service_2" =================================== ------------------ ---------------------------------  Option   Value  ------------------ --------------------------------- Class Full\Qualified\Class2 Tags tag1 (attr1: val1, attr2: val2) tag1 (attr3: val3) tag2 Calls setMailer Public no Synthetic yes Lazy no Shared yes Abstract no Autowired no Autowiring Types - Required File /path/to/file Factory Service factory.service Factory Method get ------------------ ---------------------------------'
+' // This service is an alias for the service service_2 Information for Service "service_2" =================================== ------------------ ---------------------------------  Option   Value  ------------------ --------------------------------- Service ID service_2 Class Full\Qualified\Class2 Tags tag1 (attr1: val1, attr2: val2) tag1 (attr3: val3) tag2 Calls setMailer Public no Synthetic yes Lazy no Shared yes Abstract no Autowired no Autowiring Types - Required File /path/to/file Factory Service factory.service Factory Method get ------------------ ---------------------------------'
```

#### After:

```diff
There was 1 failure:

1) Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\TextDescriptorTest::testDescribeContainerDefinitionWhichIsAnAlias with data set #1 (Symfony\Component\DependencyInjection\Alias Object (...), ' // This serv...------', Symfony\Component\DependencyInjection\ContainerBuilder Object (...), array('alias_2'))
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
  ------------------ ---------------------------------
+  Service ID         service_2
   Class              Full\Qualified\Class2
   Tags               tag1 (attr1: val1, attr2: val2)
                      tag1 (attr3: val3)
                      tag2
   Calls              setMailer
   Public             no
   Synthetic          yes
   Lazy               no
   Shared             yes
   Abstract           no
   Autowired          no
   Autowiring Types   -
   Required File      /path/to/file
   Factory Service    factory.service
   Factory Method     get
  ------------------ ---------------------------------'
```

Commits
-------

efd00bac20 [FrameworkBundle] Revert AbstractDescriptorTest output trimming
2017-01-30 07:44:32 -08:00
Fabien Potencier
bbf91d29f9 feature #21396 [DI] Enhance logging in compiler passes (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Enhance logging in compiler passes

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

We should log more in compiler passes - and this should be better integrated in usual log reports.

For logging more, let's drop LoggingFormatter and add a simple "log" method on ContainerBuilder.
For better integration, let's throw silenced notices - they can be caught by our Debug handler.

Commits
-------

fb200a0d2f [DI] Enhance logging in compiler passes
2017-01-30 07:41:46 -08:00
Fabien Potencier
a6c05e5fb6 bug #21462 [BrowserKit] ignore invalid cookies expires date format (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[BrowserKit] ignore invalid cookies expires date format

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

Commits
-------

f19788dd2e ignore invalid cookies expires date format
2017-01-30 07:30:55 -08:00
Fabien Potencier
5e5a88cc67 minor #21058 [DI] deprecate the strict attribute (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] deprecate the strict attribute

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

Commits
-------

49cb4dbd8c [DI] deprecate the strict attribute
2017-01-30 07:28:44 -08:00
Nicolas Grekas
8f913a7812 minor #21463 [HttpKernel] DebugHandlersListener micro optimize (SpacePossum)
This PR was merged into the 3.2 branch.

Discussion
----------

[HttpKernel] DebugHandlersListener micro optimize

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

For ref.: [php_sapi_name()](http://php.net/manual/en/function.php-sapi-name.php) returns the const `PHP_SAPI`.

This a PR out of courtesy to see if the CS/Fixer/Rule that found this case should be added to the SF set by default.

Commits
-------

f9f862f Update DebugHandlersListener.php
2017-01-30 15:51:39 +01:00
Christian Flothmann
49cb4dbd8c [DI] deprecate the strict attribute 2017-01-30 15:44:22 +01:00
SpacePossum
f9f862f6af Update DebugHandlersListener.php 2017-01-30 15:13:32 +01:00
Christian Flothmann
f19788dd2e ignore invalid cookies expires date format 2017-01-30 15:00:07 +01:00
Nicolas Grekas
4aebd3a086 minor #21456 [Console] SfStyleTest: Remove COLUMNS env on tearDown (ogizanagi)
This PR was merged into the 3.2 branch.

Discussion
----------

[Console] SfStyleTest: Remove COLUMNS env on tearDown

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

Commits
-------

b715a36 [Console] SfStyleTest: Remove COLUMN env on tearDown
2017-01-30 14:21:10 +01:00
Nicolas Grekas
84a664f929 [HttpFoundation] Mark more methods as @final 2017-01-30 10:14:56 +01:00
Rob Frawley 2nd
96107e21f1
return false early from directory resource 2017-01-29 19:05:04 -05:00
Fabien Potencier
10c9d19f6d minor #21453 [DI][DX] Do not map id to class for global classes (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI][DX] Do not map id to class for global classes

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

Using a global classname as service id without specifying the definition class attribute won't work anymore after this, in the benefit of properly throwing an exception at compilation time for a misconfigured service. Service ids could previously be wrongly interpreted as a class name.

So:
```yml
services:
    app_bar:
        arguments: ['foo']
```

will now properly result into:
> Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: The definition for "app_bar" has no class.

at compilation time.

Commits
-------

bb870304f0 [DI][DX] Do not map id to class for global classes
2017-01-29 14:49:01 -08:00
Maxime Steinhausser
bb870304f0 [DI][DX] Do not map id to class for global classes 2017-01-29 23:41:20 +01:00
Nicolas Grekas
f7ba71db7c bug #21438 [Console] Fix TableCell issues with decoration (ogizanagi)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix TableCell issues with decoration

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes (failure unrelated)
| Fixed tickets | #21434
| License       | MIT
| Doc PR        | N/A

Commits
-------

50373f3 [Console] Fix TableCell issues with decoration
2017-01-29 20:56:41 +01:00
Maxime Steinhausser
b715a36932 [Console] SfStyleTest: Remove COLUMN env on tearDown 2017-01-29 20:47:08 +01:00
Maxime Steinhausser
efd00bac20 [FrameworkBundle] Revert AbstractDescriptorTest output trimming 2017-01-29 20:35:38 +01:00
Nicolas Grekas
6791124f93 minor #21454 [Cache] Fix trigger_error (jderusse)
This PR was squashed before being merged into the 3.3-dev branch (closes #21454).

Discussion
----------

[Cache] Fix trigger_error

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

Commits
-------

ca38551 [Cache] Fix trigger_error
2017-01-29 20:06:27 +01:00
Jérémy Derussé
ca385510f0 [Cache] Fix trigger_error 2017-01-29 20:06:24 +01:00
Nicolas Grekas
fb200a0d2f [DI] Enhance logging in compiler passes 2017-01-29 19:31:47 +01:00
Fabien Potencier
bcf8b68be9 feature #21402 [Security] make LdapBindAuthenticationProvider capable of searching for the DN (lsmith77, nietonfir)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Security] make LdapBindAuthenticationProvider capable of searching for the DN

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #16823, #20905
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/7420

I guess due to the separation between the user and auth provider something like the following isn't ok  (note: the following works just fine for me but if course in the end the username is the DN and not the user provided shorter username):

```diff
diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
index 5ebb09a..18d7825 100644
--- a/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
+++ b/src/Symfony/Component/Security/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
@@ -70,7 +70,7 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider
      */
     protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token)
     {
-        $username = $token->getUsername();
+        $username = $user->getUsername();
         $password = $token->getCredentials();

         if ('' === $password) {
@@ -78,10 +78,7 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider
         }

         try {
-            $username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
-            $dn = str_replace('{username}', $username, $this->dnString);
-
-            $this->ldap->bind($dn, $password);
+            $this->ldap->bind($username, $password);
         } catch (ConnectionException $e) {
             throw new BadCredentialsException('The presented password is invalid.');
         }
diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php
index fc42419..8194c4c 100644
--- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php
+++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php
@@ -115,7 +115,7 @@ class LdapUserProvider implements UserProviderInterface
     {
         $password = $this->getPassword($entry);

-        return new User($username, $password, $this->defaultRoles);
+        return new User($entry->getDn(), $password, $this->defaultRoles);
     }

     /**
```

Therefore I created an entire new auth provider.

Commits
-------

8ddd5333a3 Merge pull request #1 from nietonfir/http_basic_ldap
a783e5c9c5 Update HttpBasicLdapFactory
a30191f30a make LdapBindAuthenticationProvider capable of searching for the DN
2017-01-28 14:14:50 -08:00
Fabien Potencier
536e073601 minor #21445 [TwigBundle] Fix the name of the cache warming test class (dunglas)
This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBundle] Fix the name of the cache warming test class

| 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

Rename the test class according to PSR-4.

Commits
-------

2bc4d3b2c1 [TwigBundle] Fix the name of the cache warming test class
2017-01-28 14:11:14 -08:00
Kévin Dunglas
f025392867
Merge branch '3.2'
* 3.2:
  [FrameworkBundle] Remove useless checks in descriptors
  fixed typo
2017-01-28 18:13:06 +01:00
Kévin Dunglas
39c81c2dce
Merge branch '2.8' into 3.2
* 2.8:
  [FrameworkBundle] Remove useless checks in descriptors
  fixed typo
2017-01-28 18:06:51 +01:00
Kévin Dunglas
5bc83c4142
minor #21341 [FrameworkBundle] Remove useless checks in descriptors (dunglas)
This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle] Remove useless checks in descriptors

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

As pointed out by @ogizanagi in https://github.com/symfony/symfony/pull/21315#discussion_r96476201, some code in FrameworkBundle's descriptors is useless because the bundle works only with DI 2.8.

Commits
-------

c759345781 [FrameworkBundle] Remove useless checks in descriptors
2017-01-28 17:36:39 +01:00
Kévin Dunglas
2bc4d3b2c1
[TwigBundle] Fix the name of the cache warming test class 2017-01-28 17:26:00 +01:00
Fabien Potencier
b2b48b1573 minor #21314 Fix upgrade guide (Jean85)
This PR was merged into the 2.7 branch.

Discussion
----------

Fix upgrade guide

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

This merges back the `UPGRADE-3.0.md` guide from master back up to 2.7. There were a lot of missing parts and a few duplications. I fear that also the other guides have the same issues.

Commits
-------

bd0c206a32 Add missing pieces in the upgrade guide to 3.0
2017-01-28 08:19:52 -08:00
Kévin Dunglas
c759345781
[FrameworkBundle] Remove useless checks in descriptors 2017-01-28 17:17:55 +01:00
Christian Flothmann
fe4f7eccf7 check for circular refs caused by method calls 2017-01-28 09:01:30 +01:00
Nicolas Grekas
cb498580d1 [DI] Add getter injection 2017-01-28 08:49:57 +01:00
Fabien Potencier
b1098d9492 Merge branch '3.2'
* 3.2:
  fixed composer dep
2017-01-27 18:43:25 -08:00
Fabien Potencier
71066530de Merge branch '3.1' into 3.2
* 3.1:
  fixed composer dep
2017-01-27 18:43:14 -08:00
Fabien Potencier
dba3e75fb2 fixed composer dep 2017-01-27 18:42:42 -08:00
Fabien Potencier
9f3072c416 Merge branch '3.2'
* 3.2:
  fixed typo
  fixed composer.json
  [HttpKernel] Fix Bundle name regression
  always check for all fields to be mapped
  clarify exception when no args are configured
  [PropertyAccess] Handle interfaces in the invalid argument exception
  [DI] Fix defaults overriding empty strings in AutowirePass
  [Debug] Workaround "null" $context
  [Debug] Remove $context arg from handleError(), preparing for PHP 7.2
  [FrameworkBundle] Dont wire "annotations.cached_reader" before removing passes
  [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling
  Fix tests with ICU 57.1
  Fix the condition checking the minimum ICU version
2017-01-27 18:39:08 -08:00
Fabien Potencier
09d5f4eb72 Merge branch '3.1' into 3.2
* 3.1:
  fixed typo
  fixed composer.json
  always check for all fields to be mapped
  clarify exception when no args are configured
  [PropertyAccess] Handle interfaces in the invalid argument exception
  [DI] Fix defaults overriding empty strings in AutowirePass
  [Debug] Workaround "null" $context
  [Debug] Remove $context arg from handleError(), preparing for PHP 7.2
  [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling
  Fix tests with ICU 57.1
  Fix the condition checking the minimum ICU version
2017-01-27 18:37:08 -08:00
Fabien Potencier
137a7748d6 fixed typo 2017-01-27 17:00:17 -08:00
Fabien Potencier
537b932302 fixed typo 2017-01-27 16:27:58 -08:00
Fabien Potencier
f904f0406d Merge branch '2.8' into 3.1
* 2.8:
  fixed composer.json
2017-01-27 16:21:39 -08:00
Fabien Potencier
4b5930ca44 fixed composer.json 2017-01-27 16:19:36 -08:00
Fabien Potencier
e8895ad102 Merge branch '2.8' into 3.1
* 2.8:
  always check for all fields to be mapped
  clarify exception when no args are configured
  [PropertyAccess] Handle interfaces in the invalid argument exception
  [DI] Fix defaults overriding empty strings in AutowirePass
  [Debug] Workaround "null" $context
  [Debug] Remove $context arg from handleError(), preparing for PHP 7.2
  [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling
  Fix tests with ICU 57.1
  Fix the condition checking the minimum ICU version
2017-01-27 16:04:57 -08:00
Fabien Potencier
791b143914 Merge branch '2.7' into 2.8
* 2.7:
  always check for all fields to be mapped
  clarify exception when no args are configured
  [PropertyAccess] Handle interfaces in the invalid argument exception
  [Debug] Workaround "null" $context
  [Debug] Remove $context arg from handleError(), preparing for PHP 7.2
  [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling
  Fix tests with ICU 57.1
  Fix the condition checking the minimum ICU version
2017-01-27 15:54:58 -08:00
Maxime Steinhausser
50373f3530 [Console] Fix TableCell issues with decoration 2017-01-27 20:08:51 +01:00