Last active
January 21, 2016 16:31
-
-
Save weltling/2a78b676b956f72373c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ob_start(); | |
session_save_path("/tmp"); | |
$sid = md5(uniqid()); | |
class CustomReadHandler extends SessionHandler { | |
public function read($session_id) | |
{ | |
return strval(file_get_contents(session_save_path() . '/sess_' . $session_id)); | |
} | |
} | |
session_set_save_handler(new CustomReadHandler(), true); | |
$handler = new CustomReadHandler(); | |
session_name('sessionname'); | |
session_id($sid); | |
session_start(); | |
//$this->assertEmpty($_SESSION); | |
var_dump(empty($_SESSION)); | |
$_SESSION['sessiondata'] = 'foo'; | |
var_dump($_SESSION); | |
session_write_close(); | |
var_dump($handler->read($sid)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment