Bug #73835 [Opn->Nab]: Redis session handler bug

From: Date: Thu, 29 Dec 2016 17:34:59 +0000
Subject: Bug #73835 [Opn->Nab]: Redis session handler bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206227@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73835&edit=1 ID: 73835 Updated by: aharvey@php.net Reported by: ben at ajmadison dot com Summary: Redis session handler bug -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Centos 7.3 PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: This appears to be fixed in https://github.com/phpredis/phpredis/issues/1062. Closing, as this isn't a PHP bug, and phpredis tracks issues on GitHub instead of here. Previous Comments: ------------------------------------------------------------------------ [2016-12-29 17:25:36] ben at ajmadison dot com 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 this bug report at https://bugs.php.net/bug.php?id=73835&edit=1

« previous php.bugs (#206227) next »