Bug #73835 [NEW]: Redis session handler bug
| From: | ben at ajmadison dot com | Date: | Thu, 29 Dec 2016 17:25:39 +0000 |
| Subject: | Bug #73835 [NEW]: Redis session handler bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206226@lists.php.net to get a copy of this message | ||
From: ben at ajmadison dot com
Operating system: Centos 7.3
PHP version: 7.1.0
Package: *General Issues
Bug Type: Bug
Bug description:Redis session handler bug
Description:
------------
There is a problem in the redis 3.1 extension in php 7+, when redis is
used as a session handler. The problem only manifests itself when new
session is being created, and has to do with php7 expecting a String.
Please reference a related bug: https://bugs.php.net/bug.php?id=71187
which is for Memcached but Redis seems to have the same issue.
The following php workaround fixed the problem:
class RedisSession extends SessionHandler
{
public function read($session_id) {
return (string)parent::read($session_id);
}
}
$sess = new RedisSession();
session_set_save_handler($sess, true);
Test script:
---------------
in php.ini i have:
session.save_handler = redis
session.save_path = "tcp://localhost:6379?weight=1"
in test.php i have:
session_start();
Expected result:
----------------
I would expect new session to be initialized.
Actual result:
--------------
Warning: session_start(): Failed to read session data: redis (path:
tcp://local
--
Edit bug report at https://bugs.php.net/bug.php?id=73835&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73835&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73835&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73835&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73835&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73835&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73835&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73835&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73835&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73835&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73835&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73835&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73835&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73835&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73835&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73835&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73835&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73835&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73835&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73835&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73835&r=mysqlcfg