Last active
December 18, 2015 22:47
-
-
Save julp/4bc6acac8ef4ca51e750 to your computer and use it in GitHub Desktop.
lazy_write and empty sessions
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
--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