summaryrefslogtreecommitdiff
path: root/src/tests/crypt_session_corrupted_session.phpt
diff options
context:
space:
mode:
authorjvoisin2018-09-10 12:17:41 +0000
committerGitHub2018-09-10 12:17:41 +0000
commit8db459e1ea3abf3b2318f172184e4cf06da2c29d (patch)
tree73ebeaf7d32a52204f3d87f61e73f3377303c610 /src/tests/crypt_session_corrupted_session.phpt
parentf103c8203140550e6a1658c31c071038ddc816af (diff)
Improve a bit the coverage
Diffstat (limited to 'src/tests/crypt_session_corrupted_session.phpt')
-rw-r--r--src/tests/crypt_session_corrupted_session.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tests/crypt_session_corrupted_session.phpt b/src/tests/crypt_session_corrupted_session.phpt
new file mode 100644
index 0000000..6ab6612
--- /dev/null
+++ b/src/tests/crypt_session_corrupted_session.phpt
@@ -0,0 +1,30 @@
1--TEST--
2Set a custom session handler
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--INI--
6sp.configuration_file={PWD}/config/config_crypt_session.ini
7session.save_path = "/tmp"
8--ENV--
9return <<<EOF
10REMOTE_ADDR=127.0.0.1
11EOF;
12--FILE--
13<?php
14
15session_start(); // Start new_session , it will read an empty session
16$_SESSION["tete"] = "titi"; // Encrypt and write the session
17$id = session_id(); // Get the session_id to use it later
18$filename = session_save_path() . '/sess_' . $id;
19session_write_close();
20
21$file_handle = fopen($filename, 'w');
22fwrite($file_handle, 'toto|s:4:"tata";');
23fclose($file_handle);
24
25session_id($id);
26session_start();
27var_dump($_SESSION);
28?>
29--EXPECTF--
30Fatal error: [snuffleupagus][cookie_encryption] Buffer underflow tentative detected in cookie encryption handling in %s/tests/crypt_session_corrupted_session.php on line %s