Skip to content

Instantly share code, notes, and snippets.

@benlemasurier
Last active December 30, 2015 06:59
Show Gist options
  • Save benlemasurier/7792620 to your computer and use it in GitHub Desktop.
Save benlemasurier/7792620 to your computer and use it in GitHub Desktop.
php session wrapper
<?php
/*
* $handler = new \Session();
* session_set_save_handler($handler, true);
* session_start();
*/
use \SparkLib\Fail;
class Session extends SessionHandler {
public function __construct() {
Fail::log('session->construct()');
}
public function read($id) {
Fail::log('session->read(' . $id . ')');
return parent::read($id);
}
public function write($id, $data) {
Fail::log('session->write(' . $id . ', ' . $data . ')');
return parent::write($id, $data);
}
public function close() {
Fail::log('session->close()');
return parent::close();
}
public function gc($lifetime) {
Fail::log('session->gc(' . $lifetime . ')');
return parent::gc($lifetime);
}
public function open($save_path, $session_id) {
Fail::log('session->open(' . $save_path . ', ' . $session_id . ')');
return parent::open($save_path, $session_id);
}
public function destroy($session_id) {
Fail::log('session->destroy(' . $session_id . ')');
return parent_destroy($session_id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment