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

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=71187&edit=1

 ID:                 71187
 Updated by:         [email protected]
 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:

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.


Previous Comments:
------------------------------------------------------------------------
[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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.