summaryrefslogtreecommitdiff
path: root/src/tests/session_encryption/crypt_session_corrupted_session.phpt
blob: eca43b49a66c27184e619a9b38063e77e623ac0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
Set a custom session handler
--SKIPIF--
<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
<?php if (!extension_loaded("session")) print "skip"; ?>
--EXTENSIONS--
session
--INI--
sp.configuration_file={PWD}/config/config_crypt_session.ini
session.save_path="/tmp"
--ENV--
return <<<EOF
REMOTE_ADDR=127.0.0.1
EOF;
--FILE--
<?php 

session_start();			// Start new_session , it will read an empty session
$_SESSION["tete"] = "titi"; // Encrypt and write the session
$id = session_id(); 		// Get the session_id to use it later
$filename = session_save_path() . '/sess_' . $id;
session_write_close();

$file_handle = fopen($filename, 'w'); 
fwrite($file_handle, 'toto|s:4:"tata";');
fclose($file_handle);

session_id($id);
session_start();
var_dump($_SESSION);
?>
--EXPECTF--
Fatal error: [snuffleupagus][127.0.0.1][cookie_encryption][drop] Buffer underflow (tentative) detected in cookie encryption handling in %s/crypt_session_corrupted_session.php on line %s