summaryrefslogtreecommitdiff
path: root/src/tests/session_encryption/crypt_session_invalid.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/session_encryption/crypt_session_invalid.phpt')
-rw-r--r--src/tests/session_encryption/crypt_session_invalid.phpt24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/session_encryption/crypt_session_invalid.phpt b/src/tests/session_encryption/crypt_session_invalid.phpt
new file mode 100644
index 0000000..8a57149
--- /dev/null
+++ b/src/tests/session_encryption/crypt_session_invalid.phpt
@@ -0,0 +1,24 @@
1--TEST--
2SESSION crypt and bad decrypt
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/config_crypt_session.ini
7--ENV--
8return <<<EOF
9REMOTE_ADDR=127.0.0.1
10EOF;
11--FILE--
12<?php
13// Do it like that to write (encrypt) the session and then to read (decrypt) the session
14session_start(); // Start new_session , it will read an empty session
15$_SESSION["toto"] = "tata"; // Encrypt and write the session
16$id = session_id(); // Get the session_id to use it later
17session_write_close(); // Close the session
18putenv("REMOTE_ADDR=127.0.0.2");
19session_id($id); // Recover the session with the previous session_id
20session_start(); // Re start the session, It will read and decrypt the non empty session
21var_dump($_SESSION); // Dump the session
22?>
23--EXPECTF--
24Warning: [snuffleupagus][cookie_encryption] Something went wrong with the decryption of the session in %s/crypt_session_invalid.php on line %d