summaryrefslogtreecommitdiff
path: root/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/session_encryption/crypt_session_read_uncrypt.phpt')
-rw-r--r--src/tests/session_encryption/crypt_session_read_uncrypt.phpt33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/session_encryption/crypt_session_read_uncrypt.phpt b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
new file mode 100644
index 0000000..f15d8b6
--- /dev/null
+++ b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
@@ -0,0 +1,33 @@
1--TEST--
2SESSION crypt/decrypt valid
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/config_crypt_session_simul.ini
7--ENV--
8return <<<EOF
9REMOTE_ADDR=127.0.0.1
10EOF;
11--FILE--
12<?php
13$current_path = dirname(getcwd()) . "/src/tests/" ;
14ini_set("session.save_path", $current_path);
15
16session_start();
17$id = session_id(); // Get the session_id to use it later
18$filename_sess = $current_path . "sess_" . $id;
19file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write a unencrypted session
20session_write_close(); // Close the session
21
22session_id($id);
23session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session
24var_dump($_SESSION);
25echo "OK";
26unlink($filename_sess);
27?>
28--EXPECTF--
29array(1) {
30 ["toto"]=>
31 string(4) "tata"
32}
33OK