This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle
Fabien Potencier 85d40686ab merged branch drak/sessionhandler (PR #3493)
Commits
-------

eb9bf05 [HttpFoundation] Remove hard coded assumptions and replace with API calls.
9a5fc65 [HttpFoundation] Add more tests.
68074a2 Changelog and upgrading changes.
7f33b33 Refactor SessionStorage to NativeSessionStorage.
b12ece0 [HttpFoundation][FrameworkBundle] Separate out mock session storage and stop polluting global namespace.
d687801 [HttpKernel] Mock must invoke constructor.
7b36d0c [DoctrineBridge][HttpFoundation] Refactored tests.
39526df [HttpFoundation] Refactor away options property.
21221f7 [FrameworkBundle] Make use of session API.
cb873b2 [HttpFoundation] Add tests and some CS/docblocks.
a6a9280 [DoctrineBridge] Refactor session storage to handler.
a1c678e [FrameworkBundle] Add session.handler service and handler_id configuration property.
1308312 [HttpFoundation] Add and relocate tests.
88b1170 [HttpFoundation] Refactor tests.
2257a3d [HttpFoundation] Move session handler classes.
0a064d8 [HttpFoundation] Refactor session handlers.
2326707 [HttpFoundation] Split session handler callbacks to separate object.
bb30a44 [HttpFoundation] Prepare to split out session handler callback from session storage.

Discussion
----------

[2.1] Support PHP 5.4 \SessionHandler

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

This patch allows us to add services, like an encryption layer into any session handler without having to alter or inherit any code across any session handler, internal or custom.

The `\SessionHandler` class exposes internal PHP's native internal session save handlers like files, memcache, and sqlite by wrapping the internal callbacks through the class giving user-space the chance to intercept, override and filter them by inheriting from `\SessionHandler`.  I've written a pretty nice use-case at http://docs.php.net/sessionhandler which really shows the power of it. I never considered how to make proper use of the `\SessionHandler` in Symfony2 until I wrote the code example you see in that documentation and also because of the `AbstractSessionStorage` base class got in the way.

It's really trivial to enable support for this in Symfony2 but requires to separate out the actual handlers because inheritance is not suitable.

Obviously, the feature will only work with internal PHP-extension provided handlers under PHP 5.4 and will already work in PHP 5.3 with any custom handler (since they all implement `\SessionHandlerInterface`). Symfony2 will also be the first framework to support these amazing features :-D

The necessary changes are really small but beautiful:

The basic idea is this: 1d55d1ff14  removed inheritance and separates out the actual session handler callbacks - the part PHP processes internally.

This is supported by an internal proxy mechanism: 10a36c901e

In terms of BC, not much changes net from 2.0:

  - We can restore the deprecated service ID: `session.storage.native`
  - We add a new service ID `session.handler` (and configuration alias `handler_id`) for the actual session handlers.  This defaults to the renamed `session.handler.native_file` session handler (same behaviour just new name and as it's a default there is no BC break).

---------------------------------------------------------------------------

by fabpot at 2012-03-03T12:15:10Z

Looks good to me. Can you update the CHANGELOG and UPGRADE file accordingly and start to update the documentation at symfony/symfony-docs? Thanks for your work, the session handling in Symfony2 is starting to become amazing!

---------------------------------------------------------------------------

by drak at 2012-03-04T11:09:31Z

@fabpot I will start working on documentation this week and get the CHANGELOG/UPGRADING committed shortly.  I'll ping when done.

---------------------------------------------------------------------------

by drak at 2012-03-14T16:48:37Z

@fabpot - This PR is ready now.
2012-03-15 06:59:41 +01:00
..
CacheWarmer moved WarmableInterface to the HttpKernel component 2011-10-23 09:47:17 +02:00
Command Fixed misleading help for "name" argument as search for services with wildcards is not implemented 2012-03-07 12:09:07 +01:00
Console [Console] Enable process isolantion in Shell 2012-02-02 10:09:00 +01:00
Controller Reverting return type left by mistake 2012-03-01 23:47:51 +01:00
DataCollector fixed exception in the profile/WDT when no route matches 2012-02-12 13:51:16 +01:00
Debug [FrameworkBundle] Return Event 2012-03-10 16:07:55 +05:45
DependencyInjection Refactor SessionStorage to NativeSessionStorage. 2012-03-14 20:59:57 +05:45
EventListener [HttpFoundation][FrameworkBundle] Separate out mock session storage and stop polluting global namespace. 2012-03-14 20:32:06 +05:45
HttpCache [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
Resources merged branch drak/sessionhandler (PR #3493) 2012-03-15 06:59:41 +01:00
Routing [FrameworkBundle] Fix a bug in the RedirectableUrlMatcher 2012-02-24 11:26:41 +01:00
Templating renamed getFlashes() to getFlashBag() to avoid clashes 2012-02-11 13:18:56 +01:00
Test merged 2.0 2011-12-13 16:12:53 +01:00
Tests [HttpFoundation][FrameworkBundle] Separate out mock session storage and stop polluting global namespace. 2012-03-14 20:32:06 +05:45
Translation [FrameworkBundle] fixed previous commit 2011-12-08 08:13:12 +01:00
Validator removed unused use statements 2011-10-29 11:56:30 +02:00
Client.php added missing ' escaping 2011-07-22 13:37:23 +02:00
composer.json Removed version field 2012-02-27 09:59:20 +01:00
ContainerAwareEventDispatcher.php [FrameworkBundle] Return Event 2012-03-10 16:07:55 +05:45
FrameworkBundle.php added cache clear hook 2011-12-19 12:17:48 -06:00
HttpKernel.php removed unneeded local variable 2012-02-12 08:57:10 -05:00