Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed PHP 7 Catchable fatal error: session_regenerate_id(): Failed to create(read) session ID: user (path: ) #12206

Closed
wants to merge 3 commits into from

Conversation

yitype
Copy link
Contributor

@yitype yitype commented Sep 6, 2016

  • read not returning always a string
  • destroy wrongly returning false when session doesn't exist.

read

If read returns anything else than a string it will fail with PHP Catchable fatal error: session_regenerate_id(): Failed to create(read) session ID: user. PHP 7 requires that reading always returns a string, regardless the existence of data.

destroy

When session_regenerate_id() is called right after session_start() php tries to destroy a session that doesn't exist yet. destroy() to wrongly return false when the session doesn't exist yet. PHP 7 will then fail with Warning: session_regenerate_id(): Session object destruction failed. ID: user (path: ) .

// with PHP 7.0.10 and Phalcon 3.0.1
use Phalcon\Session\Adapter\Redis as SessionAdapterRedis;

$session = new SessionAdapterRedis([
    'host'     => '127.0.0.1',
    'port'     => 6379,
]);

$session->start();

$oldId = $session->getId();

$session->regenerateId();

var_dump($oldId);
var_dump($session->getId());

@sergeyklay
Copy link
Contributor

sergeyklay commented Sep 6, 2016

@zhao5908 Could you please rebase and update CHANGELOG.md?

@yitype
Copy link
Contributor Author

yitype commented Sep 7, 2016

Thanks @sergeyklay

@sergeyklay sergeyklay added this to the 3.0.2 milestone Sep 7, 2016
@sergeyklay sergeyklay self-assigned this Sep 7, 2016
@sergeyklay
Copy link
Contributor

Fixed in the 3.0.x branch.

@thilinah
Copy link

I'm was having this issue with 3.0.x and fixed it via extending redis.zep in php. Please check #12331

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants