11 Commits

Author SHA1 Message Date
zorro-fr24
b6cf6361dd Add cluster support for strict sessions and lazy write
* Add ini setting redis.session.early_refresh to allow for session TTL updates on session start ( requires redis server version 6.2 or greater )
 * Enable cluster session support for strict mode sessions ( via PS_VALIDATE_SID_FUNC )
 * Cluster sessions used to write on every session, now we only write if the session has been modified.
 * Send EXPIRE instead of SETEX if sessioh has not been changed
 * If early refresh is enabled use GETEX for initial session read
 * When strict sessions are enabled, check whether the session exists first, validate sid and regenerate if necessary
2022-12-06 10:45:52 -08:00
michael-grunder
f9928642b5 PHP 5 is dead, long live PHP 7
This commit removes support for PHP 5 by getting rid of all of our Zend
compatibility layer methods, as well as any call checking against
PHP_MAJOR_VERSION or ZEND_MODULE_API_NO.

Unit tests are all passing for Redis, RedisCluster, and RedisArray but
this should still be considered a work in progress until more testing
can be done.

Addresses issue #1448
2019-01-26 20:57:16 -08:00
Hongbo Liu
aaaf0f233a Add callbacks validate_sid() & update_timestamp() to session handler
Newer session handler API(PS_MOD_UPDATE_TIMESTAMP) supports 2 more callbacks:

* validate_sid() is used by session.use_strict_mode, which provides better security.
* update_timestamp() is used by session.lazy_write, which can improve performance in some situations.
2018-06-04 09:38:35 +03:00
Andrew Sharpe
4530944ed0 Allow session locking to work with session_regenerate_id (see #1267) 2017-12-24 16:04:09 +10:00
michael-grunder
b63d79958e Refactored session locking logic
* Use a precalculated SHA1 of our lock release script and first
  attempt to EVALSHA the script while falling back to EVAL if that
  fails.  This means that the very first time we attempt to release
  a lock after server restart or script cache will fail but subsequent
  attempts will succeed as Redis will cache the script automatically.

* Reorganized the new locking prototypes by making them static and removing
  them from the header file as they never need to be called from outside
  of redis_session.c anyway.  Did the same for the lock_secret structure
  as we don't need to expose the structure externally.

* Consolidated allocation and deallocation of lock pointers such that our
  redis_pool "constructor" and "desctructor" handle that as well.

* Updating how we release the lock means we no longer need the new REDIS_G
  module globals, so those were removed.

* HOST_NAME_MAX doesn't exist on OSX so added some preprocessor logic around that

Still a WIP as it needs more testing as I'm sure I broke *something* :-)
2017-11-10 13:46:48 -08:00
Marius Meissner
99a81d38ec PHPREDIS-37: Replaced smart_string operations by spprintf 2017-11-02 13:00:26 +01:00
Marius Meissner
3c2d3fa7bb PHPREDIS-37: Handle return value of redis_socket_write in lock_release and upload_lock_release_script 2017-11-02 11:55:38 +01:00
Marius Meissner
abb862d2f5 PHPREDIS-37: Add locking functionality 2017-10-30 11:28:33 +01:00
michael-grunder
fcea71f99b Initial commit for cluster-enabled session handling 2015-06-17 12:45:54 -07:00
Nicolas Favre-Felix
73d99c3ec8 Added configure flag to disable sessions. 2011-06-25 23:09:09 +01:00
Nicolas Favre-Felix
4963a9aa2b New feature: PHP session handler. 2010-12-02 16:32:33 +01:00