Skip to content

Commit

Permalink
[HttpFoundation] implement session locking for PDO
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed May 17, 2014
1 parent 1ad7d05 commit 50ec828
Show file tree
Hide file tree
Showing 3 changed files with 327 additions and 115 deletions.
Expand Up @@ -12,13 +12,22 @@
/**
* SessionHandlerInterface for PHP < 5.4
*
* The order in which these methods are invoked by PHP are:
* 1. open [session_start]
* 2. read
* 3. gc [optional depending on probability settings: gc_probability / gc_divisor]
* 4. destroy [optional when session_regenerate_id(true) is used]
* 5. write [session_write_close] or destroy [session_destroy]
* 6. close
*
* Extensive documentation can be found at php.net, see links:
*
* @see http://php.net/sessionhandlerinterface
* @see http://php.net/session.customhandler
* @see http://php.net/session-set-save-handler
*
* @author Drak <drak@zikula.org>
* @author Tobias Schultze <http://tobion.de>
*/
interface SessionHandlerInterface
{
Expand Down Expand Up @@ -57,6 +66,9 @@ public function read($sessionId);
/**
* Writes the session data to the storage.
*
* Care, the session ID passed to write() can be different from the one previously
* received in read() when the session ID changed due to session_regenerate_id().
*
* @see http://php.net/sessionhandlerinterface.write
*
* @param string $sessionId Session ID , see http://php.net/function.session-id
Expand Down

5 comments on commit 50ec828

@anlutro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be considered backwards incompatible?

Does this not usually wrap your entire application in a database transaction?

@Tobion
Copy link
Member Author

@Tobion Tobion commented on 50ec828 May 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why you should not use the same database connection you use for other stuff.

@anlutro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what struck me when reading this commit, but a lot of existing applications will not enforce this. I know Laravel 4 at the moment will have problems with this. Probably not something that Symfony's team should care strongly about, but wanted to hear an opinion on it at least. Thanks.

@Tobion
Copy link
Member Author

@Tobion Tobion commented on 50ec828 May 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see also #10931 which allows to lazy-connect which means it uses a seperate connection which is prob the better way to use it.

@anlutro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very interesting, thanks for your replies. Will keep an eye out for this.

Please sign in to comment.