summaryrefslogtreecommitdiff
path: root/ext/session/tests/save_handler.inc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/session/tests/save_handler.inc')
-rw-r--r--ext/session/tests/save_handler.inc41
1 files changed, 40 insertions, 1 deletions
diff --git a/ext/session/tests/save_handler.inc b/ext/session/tests/save_handler.inc
index d271748259..79ebaaabb0 100644
--- a/ext/session/tests/save_handler.inc
+++ b/ext/session/tests/save_handler.inc
@@ -20,6 +20,8 @@ function read($id) {
$session_id = $id;
echo "Read [${session_save_path},${id}]\n";
$session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ // read MUST create file. Otherwise, strict mode will not work
+ touch($session_file);
return (string) @file_get_contents($session_file);
}
@@ -31,7 +33,7 @@ function write($id, $session_data) {
if ($fp = fopen($session_file, "w")) {
$return = fwrite($fp, $session_data);
fclose($fp);
- return (bool)$return;
+ return $return === FALSE ? FALSE : TRUE;
}
return false;
}
@@ -60,5 +62,42 @@ function gc($maxlifetime) {
return true;
}
+function create_sid() {
+ $id = ('PHPT-'.time());
+ echo "CreateID [${id}]\n";
+ return $id;
+}
+
+function validate_sid($id) {
+ global $session_save_path, $name;
+ echo "ValidateID [${session_save_path},${id}]\n";
+ $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ $ret = file_exists($session_file);
+ return $ret;
+}
+
+function update($id, $session_data) {
+ global $session_save_path, $name;
+ echo "Update [${session_save_path},${id}]\n";
+ $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
+ $ret = touch($session_file);
+ return $ret;
+}
+
+
+function feature() {
+ /* NOT IMPLEMENTED YET */
+ /* TYPES: gc, create_sid, use_strict_mode, minizie_lock, lazy_write
+ /* VALUES: 0=unknown, 1=supported, 2=partially supported, 3=unsupported */
+ return array('gc'=>0,
+ 'create_sid'=>1,
+ 'use_strict_mode'=>2,
+ 'minimize_lock'=>3,
+ 'lazy_write'=>4,
+ 'invalid'=>5,
+ 'another invalid'=>6
+ );
+}
+
?>