Skip to content

Instantly share code, notes, and snippets.

@julp julp/test.phpt
Last active Dec 18, 2015

Embed
What would you like to do?
lazy_write and empty sessions
--TEST--
session.lazy_write triggers updateTimestamp callback when session remains empty
--INI--
session.lazy_write=1
--FILE--
<?php
class MySessionHandler implements SessionHandlerInterface#, SessionUpdateTimestampHandlerInterface
{
public function close() {
return TRUE;
}
public function destroy($sessid) {
return TRUE;
}
public function gc($maxlifetime) {
return TRUE;
}
public function open($path, $sessname) {
return TRUE;
}
public function read($sessid) {
return '';
}
public function write($sessid, $sessdata) {
echo __FUNCTION__, PHP_EOL;
return TRUE;
}
public function updateTimestamp($sessid, $sessdata) {
echo __FUNCTION__, PHP_EOL;
return TRUE;
}
}
$handler = new MySessionHandler();
session_set_save_handler($handler);
session_id(md5(''));
session_start();
--EXPECT--
updateTimestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.