Bug #71187 [Asn->Csd]: session_regenerate_id(): Failed to create(read) session
Edit report at https://bugs.php.net/bug.php?id=71187&edit=1
ID: 71187
Updated by: yohgaki@php.net
Reported by: akauffman at ne4u dot com
Summary: session_regenerate_id(): Failed to create(read)
session
-Status: Assigned
+Status: Closed
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:
Please note that
- PHP 7.0 and up does not allow buggy return values from user save handler.
user read handler MUST return "string" data for success always.
- Native save handler must return SUCCESS for successful cases including non-existing session data.
- FALSE/failure means "Something wrong in read" such as permission/network/etc errors.
Checked memcached code and it needs this patch.
@@ -326,6 +326,8 @@ PS_READ_FUNC(memcached)
*val = zend_string_init(payload, payload_len, 1);
free(payload);
return SUCCESS;
+ } else if (status = MEMCACHED_NOTFOUND) {
+ *val = ZSTR_EMPTY_ALLOC();
} else {
return FAILURE;
}
I made PR including new session features.
https://github.com/php-memcached-dev/php-memcached/pull/164
Since this is not PHP session module bug, closed.
Previous Comments:
------------------------------------------------------------------------
[2016-01-06 12:31:05] andrew dot mcgrath at fasttrackit dot com dot au
I'm experiencing this issue too, but I wanted to confirm that the work around described in the
bug report seems to function as a reasonable work around.
------------------------------------------------------------------------
[2015-12-24 15:04:56] ivun at wirebyte dot com
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!
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=71187
--
Edit this bug report at https://bugs.php.net/bug.php?id=71187&edit=1
Thread (7 messages)