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

From: Date: Mon, 21 Dec 2015 20:39:32 +0000
Subject: Bug #71187 [NEW]: session_regenerate_id(): Failed to create(read) session
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198111@lists.php.net to get a copy of this message
From:             akauffman at ne4u dot com
Operating system: Ubuntu 14.04 LTS
PHP version:      7.0.1
Package:          Session related
Bug Type:         Bug
Bug description:session_regenerate_id(): Failed to create(read) session

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 bug report at https://bugs.php.net/bug.php?id=71187&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=71187&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=71187&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=71187&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=71187&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=71187&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=71187&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=71187&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=71187&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=71187&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=71187&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=71187&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=71187&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=71187&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71187&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=71187&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=71187&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=71187&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71187&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=71187&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=71187&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#198111) next »