diff options
| author | jvoisin | 2018-09-10 12:17:41 +0000 |
|---|---|---|
| committer | GitHub | 2018-09-10 12:17:41 +0000 |
| commit | 8db459e1ea3abf3b2318f172184e4cf06da2c29d (patch) | |
| tree | 73ebeaf7d32a52204f3d87f61e73f3377303c610 /src/tests/crypt_session_corrupted_session.phpt | |
| parent | f103c8203140550e6a1658c31c071038ddc816af (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.phpt | 30 |
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-- | ||
| 2 | Set a custom session handler | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_crypt_session.ini | ||
| 7 | session.save_path = "/tmp" | ||
| 8 | --ENV-- | ||
| 9 | return <<<EOF | ||
| 10 | REMOTE_ADDR=127.0.0.1 | ||
| 11 | EOF; | ||
| 12 | --FILE-- | ||
| 13 | <?php | ||
| 14 | |||
| 15 | session_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; | ||
| 19 | session_write_close(); | ||
| 20 | |||
| 21 | $file_handle = fopen($filename, 'w'); | ||
| 22 | fwrite($file_handle, 'toto|s:4:"tata";'); | ||
| 23 | fclose($file_handle); | ||
| 24 | |||
| 25 | session_id($id); | ||
| 26 | session_start(); | ||
| 27 | var_dump($_SESSION); | ||
| 28 | ?> | ||
| 29 | --EXPECTF-- | ||
| 30 | Fatal error: [snuffleupagus][cookie_encryption] Buffer underflow tentative detected in cookie encryption handling in %s/tests/crypt_session_corrupted_session.php on line %s | ||
