-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[HttpFoundation] Deprecate compatibility with PHP <5.4 sessions #24239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| public function setSaveHandler($saveHandler = null) | ||
| { | ||
| if (!$saveHandler instanceof AbstractProxy && | ||
| !$saveHandler instanceof NativeSessionHandler && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be reverted as that's a BC break, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, since Symfony 3.0, NativeSessionHandler always extends \SessionHandler. Thus now the rule !$saveHandler instanceof NativeSessionHandler is covered by !$saveHandler instanceof \SessionHandlerInterface
640661c to
71a92a2
Compare
| */ | ||
|
|
||
| namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't you add a deprecated notice here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had one, but removed it because AbstractProxy is extended by SessionHandlerProxy and this will make the tests that use SessionHandlerProxy to not pass. I can't mark these tests as legacy. What's a good solution to have a deprecation notice here and tests pass?
| * | ||
| * @author Drak <[email protected]> | ||
| */ | ||
| class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also move this class from the Proxy folder to Handler. What do you think, @nicolas-grekas ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would need deprecating this class in favor of the new one, and allow triggering a deprecation in AbstractProxy also. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the SessionHandlerProxy can be deprecated as well. When we only support \SessionHandlerInterface anyway, the proxy does not provide any value anymore AFAIK. I was meant as a way to make \SessionHandlerInterface and others behave the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the same. The extra methods that SessionHandlerProxy is having can easily be moved to NativeSessionStorage as they are relevant only for a native session storage.
sstok
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments on the changelog, but it seems the HttpFoundation also has this rather strange commentary usage.
UPGRADE-3.4.md
Outdated
| `TranslationDebugCommand`, `TranslationUpdateCommand`, `XliffLintCommand` | ||
| and `YamlLintCommand` classes have been marked as final | ||
|
|
||
| HttpKernel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing capital in the sentence (see other lines in this file).
And each line is separated by a single white line.
| * the `Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::isWrapper()` | ||
| method has been deprecated and will be removed in 4.0. You can check explicitly if the proxy wraps | ||
| a `\SessionHandler` instance. | ||
| * `NativeSessionStorage::setSaveHandler()` now takes an instance of `\SessionHandlerInterface` as argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate header (wrong rebase?)
|
|
||
| * `AssetsInstallCommand`, `CacheClearCommand`, `CachePoolClearCommand`, | ||
| `EventDispatcherDebugCommand`, `RouterDebugCommand`, `RouterMatchCommand`, | ||
| `TranslationDebugCommand`, `TranslationUpdateCommand`, `XliffLintCommand` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This header should be HttpFoundation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
845d5a6 to
f275707
Compare
|
Comments addressed :) |
UPGRADE-3.4.md
Outdated
| and `YamlLintCommand` classes have been marked as final | ||
|
|
||
| HttpFoundation | ||
| ---------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong number of dashes :)
|
Please also update the |
415ddf0 to
46c0740
Compare
|
Ready for review. I've also deprecated |
Signed-off-by: Alexandru Furculita <[email protected]>
Signed-off-by: Alexandru Furculita <[email protected]>
| $storage = $this->getStorage(); | ||
| $storage->setSaveHandler(); | ||
| $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); | ||
| $this->assertInstanceOf(SessionHandlerProxy::class, $storage->getSaveHandler()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't change that to avoid conflicts unless the line needs to be touched anyway. so this should be reverted.
| * | ||
| * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler | ||
| * @param MetadataBag $metaBag MetadataBag | ||
| * @param AbstractProxy|\SessionHandlerInterface|null $handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argument types that are deprecated should be removed from the doc
| * @param AbstractProxy|NativeSessionHandler|\SessionHandlerInterface|null $handler | ||
| * @param MetadataBag $metaBag MetadataBag | ||
| * @param array $options Session configuration options | ||
| * @param AbstractProxy|\SessionHandlerInterface|null $handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, AbstractProxy should not be documented anymore
|
@Tobion OK for you? Can I let you merge if yes? |
|
Thank you @afurculita. |
… sessions (afurculita) This PR was squashed before being merged into the 3.4 branch (closes #24239). Discussion ---------- [HttpFoundation] Deprecate compatibility with PHP <5.4 sessions | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This PR removes functionality added in Symfony 2.1 as a compatibility layer with sessions from PHP <5.4. - [x] Fix tests Commits ------- 3deb394 [HttpFoundation] Deprecate compatibility with PHP <5.4 sessions
|
@afurculita could you work on a PR against master to remove the deprecated stuff? Would be much appreciated. |
|
@Tobion already started it ;) |
…5.4 sessions (afurculita) This PR was merged into the 4.0-dev branch. Discussion ---------- [HttpFoundation] Removed compatibility layer for PHP <5.4 sessions | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This is a follow-up of #24239. This PR removes the compatibility layer added for sessions for PHP <5.4. Commits ------- 37d1a21 Removed compatibility layer for PHP <5.4 sessions
This PR removes functionality added in Symfony 2.1 as a compatibility layer with sessions from PHP <5.4.