Bug #71187 [Com]: session_regenerate_id(): Failed to create(read) session

From: Date: Thu, 24 Dec 2015 15:04:57 +0000
Subject: Bug #71187 [Com]: session_regenerate_id(): Failed to create(read) session
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198197@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71187&edit=1 ID: 71187 Comment by: ivun at wirebyte dot com Reported by: akauffman at ne4u dot com Summary: session_regenerate_id(): Failed to create(read) session Status: Assigned Type: Bug Package: Session related Operating System: Ubuntu 14.04 LTS PHP Version: 7.0.1 Assigned To: yohgaki Block user comment: N Private report: N New Comment: Hello! We are having exactly the same problem. In addition, this seems to be a major problem, because the memcache (alternative to memcached) driver is not available any more and this bugs prevents from upgrading to PHP7. Looking forward for the fix! Previous Comments: ------------------------------------------------------------------------ [2015-12-22 15:22:03] akauffman at ne4u dot com Memcache with php7: $ git clone https://github.com/php-memcached-dev/php-memcached $ cd php-memcached $ git checkout -b php7 origin/php7 $ /usr/local/php7/bin/phpize $ ./configure --with-php-config=/usr/local/php7/bin/php-config $ make $ sudo make install modules.ini # Memcached extension=memcached.so ------------------------------------------------------------------------ [2015-12-22 14:22:30] coldfff at gmail dot com In case its any easier for testing, this bug is affecting me too using the Cache Savehandler from ZF2. The workaround as suggested can also be applied there: <?php use Zend\Session\SaveHandler\Cache as ZendCache; class Cache extends ZendCache { public function read($id) { return (string) parent::read($id); } } ------------------------------------------------------------------------ [2015-12-22 05:08:02] yohgaki@php.net When I ported the save handler, I think I made sure it returns string always for successful cases. I'll have a look shortly. @akauffman, could you give info where did you get the memeached module source code? Just making sure to get the same code. ------------------------------------------------------------------------ [2015-12-21 20:39:29] akauffman at ne4u dot com Description: ------------ There seems to be a type casting problem with custom session handlers (specifically the memcached module) when session_regenerate_id() is called. Perhaps related to a null return value. It looks like it was introduced around 7RC3. Error: PHP message: PHP Catchable fatal error: session_regenerate_id(): Failed to create(read) session ID: user Test script: --------------- Problem: <?php set_ini('session.save_handler','memcached'); set_ini('session.save_path','host1:11211'); session_start(); $_SESSION['value'] = session_id(); session_regenerate_id(); ?> Work around: <?php set_ini('session.save_handler','memcached'); set_ini('session.save_path','host1:11211'); class MemcachedSession extends SessionHandler { public function read($session_id) { return (string)parent::read($session_id); } } $sess = new MemcachedSession(); session_set_save_handler($sess, true); session_start(); $_SESSION['value'] = session_id(); session_regenerate_id(); ?> Expected result: ---------------- Shouldn't have to implement a workaround. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71187&edit=1

« previous php.bugs (#198197) next »