summaryrefslogtreecommitdiff
path: root/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
blob: 5e81b52ef5609bcdaca27ab223c80a2d50782fd6 (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--
SESSION crypt/decrypt valid
--SKIPIF--
<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
--INI--
sp.configuration_file={PWD}/config/config_crypt_session_simul.ini
--ENV--
return <<<EOF
REMOTE_ADDR=127.0.0.1
EOF;
--FILE--
<?php
$current_path = dirname(getcwd()) . "/src/tests/" ;
ini_set("session.save_path", $current_path);

session_start();
$id = session_id(); 											// Get the session_id to use it later
$filename_sess = $current_path . "sess_" . $id;
file_put_contents($filename_sess, "toto|s:4:\"tata\";"); 			// Write a unencrypted session
session_write_close(); 											// Close the session

session_id($id);
session_start();												// Try to read the unencrypted session, it will fail to decrypt but it must return the session
var_dump($_SESSION);
echo "OK";
unlink($filename_sess);
?>
--EXPECTF--
array(1) {
  ["toto"]=>
  string(4) "tata"
}
OK