summaryrefslogtreecommitdiff
path: root/src/tests/crypt_session_invalid_simul.phpt
blob: 7bfefcb2ef8be5b3eabf5bd6eef0a4f567747963 (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
--TEST--
SESSION crypt and bad decrypt
--SKIPIF--
<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
--INI--
sp.configuration_file={PWD}/config/config_crypt_session_simul.ini
--ENV--
return <<<EOF
REMOTE_ADDR=127.0.0.1
EOF;
--FILE--
<?php
// Do it like that to write (encrypt) the session and then to read (decrypt) the session
session_start();			// Start new_session , it will read an empty session
$_SESSION["toto"] = "tata"; // Encrypt and write the session
$id = session_id(); 		// Get the session_id to use it later
session_write_close(); 		// Close the session
putenv("REMOTE_ADDR=127.0.0.2");
session_id($id); 			// Recover the session with the previous session_id
session_start(); 			// Re start the session, It will read and decrypt the non empty session
var_dump($_SESSION); 		// Dump the session
?>
--EXPECTF--
array(1) {
  ["toto"]=>
  string(4) "tata"
}