Commit Graph

43047 Commits

Author SHA1 Message Date
Fabien Potencier
51eb41b4c6 bug #32455 [HttpFoundation] Clear invalid session cookie (Toflar)
This PR was submitted for the 4.2 branch but it was squashed and merged into the 4.3 branch instead (closes #32455).

Discussion
----------

[HttpFoundation] Clear invalid session cookie

| Q             | A
| ------------- | ---
| Branch?       | 4.2 (actually maybe should also go to 3.4, see below)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | TODO
| Fixed tickets |
| License       | MIT
| Doc PR        | not required

Currently, invalid session cookies are not cleaned up.

If the session is empty, the `AbstractSessionHandler::write()` destroys the session. If a new session has been started in the current process (meaning `session_start()` has sent the `Set-Cookie` header) then the `AbstractSessionHandler` will make sure this cookie is not sent to the client. If, however, `session_start()` did not send a cookie (meaning there was already a valid session ID in your request cookie), the `AbstractSessionHandler` will clear the session cookie (send a 0-lifetime cookie).
If, however, the request does contain a session ID cookie but it is not valid, `session_start()` will send a new cookie which is then again cleared by the `AbstractSessionHandler`. But it will not clear the old cookie sent by the request.

Here's a more complex example of what happens in the code flow when a user logs out and we regenerate a new session id for security reasons:

1. You have no `PHPSESSID` cookie yet.
2. You log into the system, you get a new `PHPSESSID` assigned. Let's go for session ID `1`.
3. You log out of the system, for security reasons you get session ID `2` regenerated.
4. The `AbstractSessionListener` pops in and calls `->save()` on your session handler.
5. The `NativeSessionStorage` calls the `StrictSessionHandler` (in fact the abstract parent, `AbstractSessionHandler`) which `write()`s the session data. In case the session data is empty, it will actually `destroy()` the session which means it will invalidate the session cookie. In that case, however, it won't send a 0-lifetime cookie because `$cookie = SessionUtils::popSessionCookie($this->sessionName, $sessionId);` will **not** return `null`. That is because after regeneration we actually do have a `Set-Cookie: PHPSESSID=2` header present.
6. This means, our `PHPSESSID=1` cookie is never deleted.

Why is this a problem?
Well, we have an invalid cookie that remains floating around forever. Loads of reverse proxies consider requests with cookies as being private and thus disable caching.

I'm not sure this is the correct fix here but it felt like the only place we can do this because it has to happen during or after `$session->save()`.

Looking for feedback first before we finish this with tests etc.

Regarding Symfony 3.4: Not sure how this is affected because there's not even a `SessionUtils` class so I'd prefer to leave that fix to somebody who feels more comfortable with that code base 😄

/cc @aschempp

Commits
-------

b22a7263b9 [HttpFoundation] Clear invalid session cookie
2019-08-09 09:08:28 +02:00
Yanick Witschi
b22a7263b9 [HttpFoundation] Clear invalid session cookie 2019-08-09 09:08:17 +02:00
Fabien Potencier
e848729ba7 bug #33066 [Serializer] Fix negative DateInterval (jderusse)
This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] Fix negative DateInterval

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

This PR adds support for negative and signed DateInterval

Commits
-------

abb8a676ba Fix negative DateInterval
2019-08-09 08:01:14 +02:00
Nicolas Grekas
1b98df7c64 minor #33067 [VarDumper] Fix test patern to handle callstack with/without return typehint (jderusse)
This PR was merged into the 4.3 branch.

Discussion
----------

[VarDumper] Fix test patern to handle callstack with/without return typehint

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

The TestCase::tearDownAfterClass methods does not always have the same signature which change the output of the reflection. This use another methods for testing

Commits
-------

feaadd1c0b Fix tst patern to handle callstack with/without return typehint
2019-08-08 23:10:45 +02:00
Nicolas Grekas
85c50119f1 Merge branch '3.4' into 4.3
* 3.4:
  Replace warning by isolated test
2019-08-08 22:52:04 +02:00
Nicolas Grekas
7afc9352f3 minor #33069 Replace warning by isolated test (jderusse)
This PR was merged into the 3.4 branch.

Discussion
----------

Replace warning by isolated test

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32844
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Failing test introduced in PHP 7.4 (fatal error) were skiped with a warning exception.
This PR un tests is isolated process in order to correctly flag the test without stoping the test suite.

I kept a comment to the original bug in order to easily remove theme

Commits
-------

9c45a8e093 Replace warning by isolated test
2019-08-08 22:46:03 +02:00
Jérémy Derussé
9c45a8e093 Replace warning by isolated test 2019-08-08 22:45:38 +02:00
Jérémy Derussé
feaadd1c0b
Fix tst patern to handle callstack with/without return typehint 2019-08-08 21:16:30 +02:00
Jérémy Derussé
abb8a676ba
Fix negative DateInterval 2019-08-08 20:43:11 +02:00
Nicolas Grekas
38f08ba9dc Merge branch '3.4' into 4.3
* 3.4:
  [Intl] use strict comparisons
  Fix s-maxage=3 transient test
2019-08-08 19:11:28 +02:00
Tobias Schultze
02a90d2066 [Intl] use strict comparisons 2019-08-08 19:01:37 +02:00
Nicolas Grekas
d84ee870c2 minor #33051 [HttpKernel] Fix s-maxage=3 transient test (jderusse)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Fix s-maxage=3 transient test

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

sometime the http server returns a `s-maxage=3` header (https://travis-ci.org/symfony/symfony/jobs/569326531)
This PR fixes tests to allow both 2 and 3

Commits
-------

f019b5214d Fix s-maxage=3 transient test
2019-08-08 17:36:09 +02:00
Nicolas Grekas
fdf6fc349c Merge branch '3.4' into 4.3
* 3.4:
  Improve some URLs
  Fix test compatibility with 4.x components
  [Cache] cs fix
2019-08-08 17:11:33 +02:00
Nicolas Grekas
e4bb3a24c3 minor #32800 Improve some URLs (Arman-Hosseini)
This PR was squashed before being merged into the 3.4 branch (closes #32800).

Discussion
----------

Improve some URLs

| Q             | A
| ------------- | ---
| Branch?       | 3.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained 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 branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

fab17a4487 Improve some URLs
2019-08-08 17:01:55 +02:00
Arman Hosseini
fab17a4487 Improve some URLs 2019-08-08 17:01:12 +02:00
Nicolas Grekas
889f454f93 minor #33055 [FrameworkBundle][TwigBridge] Fix test compatibility with 4.x components (jderusse)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle][TwigBridge] Fix test compatibility with 4.x components

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

our symfony Tests extends other component's tests. By being compatible with symfony 4.x we now extends class that have return type signature which is not doable in branch 3.4 because of support of php 5.5. (see https://travis-ci.org/symfony/symfony/jobs/569345176)

This PR replaces setup and teardown by `@after` and `@before` annotation in order to keep the same behavior and compatibility

Commits
-------

bb3cb64e64 Fix test compatibility with 4.x components
2019-08-08 16:22:12 +02:00
Jérémy Derussé
bb3cb64e64
Fix test compatibility with 4.x components 2019-08-08 15:49:16 +02:00
Jérémy Derussé
f019b5214d
Fix s-maxage=3 transient test 2019-08-08 15:12:35 +02:00
Nicolas Grekas
e95b8a3291 [Cache] cs fix 2019-08-08 14:31:29 +02:00
Nicolas Grekas
f773217622 minor #33000 Fix deprecations on 4.3 (jderusse)
This PR was merged into the 4.3 branch.

Discussion
----------

Fix deprecations on 4.3

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

Fix deprecations in branch 4.3
note: remaining deprecation `assertStringContainsString` will be fixed in #32977

* [ ] fix tests in branch 3.4 in #32981

Commits
-------

8fd16a6bee Fix deprecation on 4.3
2019-08-08 14:05:37 +02:00
Nicolas Grekas
3ae991049d minor #33042 Disable typehint patch on PHPUnit (jderusse)
This PR was merged into the 4.3 branch.

Discussion
----------

Disable typehint patch on PHPUnit

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

This PR removes the `SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT` patch and adds a `: void` typehint on `setup` and `tearDown` methods in order to be compatible with PHPUnit 8

Commits
-------

a5af6c4cd7 Disable phpunit typehint patch on 4.3 branch
2019-08-08 14:02:35 +02:00
Nicolas Grekas
0abd64bb2b bug #33045 Make HttpClientTestCase compatible with PHPUnit8 (jderusse)
This PR was merged into the 4.3 branch.

Discussion
----------

Make HttpClientTestCase compatible with PHPUnit8

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

the abstract class `HttpClientTestCase` may be extends by end user and execute by both PHPUnit 8 and bellow. Adding a return typehint on it will force all users extending it to add it too and would be a BC Break.

Note. I don't know how to trigger a deprecation here and help user to add it.

Commits
-------

55daf15353 Fix compatibility with PHPUnit 8
2019-08-08 12:04:39 +02:00
Jérémy Derussé
55daf15353
Fix compatibility with PHPUnit 8 2019-08-08 12:03:27 +02:00
Jérémy Derussé
a5af6c4cd7
Disable phpunit typehint patch on 4.3 branch 2019-08-08 11:29:19 +02:00
Nicolas Grekas
c0f416eb9d Merge branch '3.4' into 4.3
* 3.4:
  consistently throw NotSupportException
  [HttpKernel] Clarify error handler restoring process again
  [Intl] fix nullable phpdocs and useless method visibility of internal class
  Resilience against file_get_contents() race conditions.
2019-08-08 11:16:40 +02:00
Nicolas Grekas
d936a707d3 minor #33020 [Intl] fix nullable phpdocs and useless method visibility of internal class (Tobion)
This PR was merged into the 3.4 branch.

Discussion
----------

[Intl] fix nullable phpdocs and useless method visibility of internal class

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets |
| License       | MIT
| Doc PR        |

Fix stuff found in #32525

Commits
-------

63b71b5ade [Intl] fix nullable phpdocs and useless method visibility of internal class
2019-08-08 11:00:58 +02:00
Nicolas Grekas
ce09c31993 minor #33016 [HttpKernel] Resilience against file_get_contents() race conditions (derrabus)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Resilience against file_get_contents() race conditions

| 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

This PR addresses https://github.com/symfony/symfony/pull/33007#discussion_r311589966.

Commits
-------

5892837641 Resilience against file_get_contents() race conditions.
2019-08-08 09:59:56 +02:00
Nicolas Grekas
e48d2c14d9 minor #33031 [HttpKernel] Clarify error handler restoring process again (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Clarify error handler restoring process again

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |https://github.com/symfony/symfony/issues/33024
| License       | MIT
| Doc PR        | -

Commits
-------

4ee54f0e84 [HttpKernel] Clarify error handler restoring process again
2019-08-08 09:54:28 +02:00
Nicolas Grekas
854f5d1dee bug #33033 [Lock] consistently throw NotSupportException (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Lock] consistently throw NotSupportException

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

Commits
-------

12b8c942eb consistently throw NotSupportException
2019-08-08 09:53:42 +02:00
Christian Flothmann
12b8c942eb consistently throw NotSupportException 2019-08-08 08:47:22 +02:00
Thomas Calvet
4ee54f0e84 [HttpKernel] Clarify error handler restoring process again 2019-08-08 08:45:40 +02:00
Nicolas Grekas
fda49e699a bug #33022 [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt (lyrixx)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt

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

Commits
-------

e289723aad [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt
2019-08-08 08:39:53 +02:00
Grégoire Pineau
e289723aad [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt 2019-08-08 08:37:38 +02:00
Jérémy Derussé
8fd16a6bee
Fix deprecation on 4.3 2019-08-08 00:24:12 +02:00
Nicolas Grekas
e8cd106a4b minor #33021 [FrameworkBundle] remove deprecated cache pool argument (xabbuh)
This PR was merged into the 4.3 branch.

Discussion
----------

[FrameworkBundle] remove deprecated cache pool argument

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

Commits
-------

3f51a55179 remove deprecated cache pool arguments
2019-08-07 19:19:57 +02:00
Christian Flothmann
3f51a55179 remove deprecated cache pool arguments 2019-08-07 19:11:50 +02:00
Tobias Schultze
63b71b5ade [Intl] fix nullable phpdocs and useless method visibility of internal class 2019-08-07 18:29:13 +02:00
Alexander M. Turek
5892837641 Resilience against file_get_contents() race conditions. 2019-08-07 17:07:08 +02:00
Nicolas Grekas
f3f6b584e4 Merge branch '3.4' into 4.3
* 3.4:
  [FrameworkBundle][Config] Ignore exeptions thrown during reflection classes autoload
2019-08-07 16:08:37 +02:00
Nicolas Grekas
48859fd125 bug #32516 [FrameworkBundle][Config] Ignore exceptions thrown during reflection classes autoload (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle][Config] Ignore exceptions thrown during reflection classes autoload

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/32499 with PHP 7.3+
| License       | MIT
| Doc PR        | -

The behavior when an exception is thrown in a class loader changed in PHP 7.3 (cf https://3v4l.org/OQPk9). That means that the `throwOnRequiredClass` trick that is done in the parent class of these cache warmers (`AbstractPhpFileCacheWarmer`) does not work anymore with PHP7.3+.

Commits
-------

dbd9b75d86 [FrameworkBundle][Config] Ignore exeptions thrown during reflection classes autoload
2019-08-07 16:06:37 +02:00
Nicolas Grekas
1aba480c2d Merge branch '3.4' into 4.3
* 3.4:
  Fix some return type annotations.
2019-08-07 14:28:41 +02:00
Nicolas Grekas
f8a35176da minor #33007 Fix some return type annotations (derrabus)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix some return type annotations

| 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

This PR fixed some incorrect return type declarations I discovered while working on #32993.

Commits
-------

0a78dc0f6f Fix some return type annotations.
2019-08-07 14:23:50 +02:00
Alexander M. Turek
0a78dc0f6f Fix some return type annotations. 2019-08-07 14:09:01 +02:00
Nicolas Grekas
b406466221 bug #33010 [TwigBridge] pass translation parameters to the trans filter (xabbuh)
This PR was merged into the 4.3 branch.

Discussion
----------

[TwigBridge] pass translation parameters to the trans filter

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

This was reported by @voltel on the Symfony Slack.

Commits
-------

daac024057 pass translation parameters to the trans filter
2019-08-07 13:55:57 +02:00
Nicolas Grekas
381c995d30 Merge branch '3.4' into 4.3
* 3.4:
  Fix inconsistent return points.
  Fix remaining tests
2019-08-07 13:52:19 +02:00
Nicolas Grekas
b27c9992c7 bug #32981 Fix tests/code for php 7.4 (jderusse)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix tests/code for php 7.4

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

Fix remaining tests and deprecation

Commits
-------

05ec8a08b4 Fix remaining tests
2019-08-07 13:49:32 +02:00
Nicolas Grekas
c88d125701 minor #33009 Fix inconsistent return points (derrabus)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix inconsistent return points

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

This PR fixes some inconsistent return points I've discovered while working on #32993. Adding return types made fixing these inconsistencies necessary, see also [this comment](https://github.com/symfony/symfony/issues/17201#issuecomment-519038719).

Commits
-------

1a83f9beed Fix inconsistent return points.
2019-08-07 13:45:59 +02:00
Alexander M. Turek
1a83f9beed Fix inconsistent return points. 2019-08-07 13:38:48 +02:00
Christian Flothmann
daac024057 pass translation parameters to the trans filter 2019-08-07 13:18:23 +02:00
Fabien Potencier
a3aaaa16e9 bug #32986 [Mime] fixed wrong mimetype (rjwebdev)
This PR was squashed before being merged into the 4.3 branch (closes #32986).

Discussion
----------

[Mime] fixed wrong mimetype

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

When creating a datapart from an odt file (and some other extensions), the explode function for the picked mimetype gives a wrong result since there's no `application/` prefix for the first mimetype of this extension.

In this PR, all mimetypes without a prefix are removed.

Commits
-------

e1722c529a [Mime] fixed wrong mimetype
2019-08-07 12:03:35 +02:00