diff options
Diffstat (limited to 'src/tests/crypt_session_invalid.phpt')
| -rw-r--r-- | src/tests/crypt_session_invalid.phpt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/crypt_session_invalid.phpt b/src/tests/crypt_session_invalid.phpt new file mode 100644 index 0000000..687a407 --- /dev/null +++ b/src/tests/crypt_session_invalid.phpt | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | --TEST-- | ||
| 2 | SESSION crypt and bad decrypt | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_crypt_session.ini | ||
| 7 | --ENV-- | ||
| 8 | return <<<EOF | ||
| 9 | REMOTE_ADDR=127.0.0.1 | ||
| 10 | EOF; | ||
| 11 | --FILE-- | ||
| 12 | <?php | ||
| 13 | // Do it like that to write (encrypt) the session and then to read (decrypt) the session | ||
| 14 | session_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 | ||
| 17 | session_write_close(); // Close the session | ||
| 18 | putenv("REMOTE_ADDR=127.0.0.2"); | ||
| 19 | session_id($id); // Recover the session with the previous session_id | ||
| 20 | session_start(); // Re start the session, It will read and decrypt the non empty session | ||
| 21 | var_dump($_SESSION); // Dump the session | ||
| 22 | ?> | ||
| 23 | --EXPECTF-- | ||
| 24 | [snuffleupagus][127.0.0.2][cookie_encryption][drop] Something went wrong with the decryption of the session. \ No newline at end of file | ||
