summaryrefslogtreecommitdiff
path: root/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/session_encryption/crypt_session_read_uncrypt.phpt')
-rw-r--r--src/tests/session_encryption/crypt_session_read_uncrypt.phpt19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/tests/session_encryption/crypt_session_read_uncrypt.phpt b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
index 5e81b52..5966f8e 100644
--- a/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
+++ b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
@@ -2,27 +2,33 @@
2SESSION crypt/decrypt valid 2SESSION crypt/decrypt valid
3--SKIPIF-- 3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> 4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5<?php if (!extension_loaded("session")) print "skip"; ?>
6--EXTENSIONS--
7session
5--INI-- 8--INI--
6sp.configuration_file={PWD}/config/config_crypt_session_simul.ini 9sp.configuration_file={PWD}/config/config_crypt_session_simul.ini
10session.save_path="{PWD}"
11display_errors=0
12log_errors=1
13error_log="{PWD}"/crypt_session_read_uncrypt.tmp
7--ENV-- 14--ENV--
8return <<<EOF 15return <<<EOF
9REMOTE_ADDR=127.0.0.1 16REMOTE_ADDR=127.0.0.1
10EOF; 17EOF;
11--FILE-- 18--FILE--
12<?php 19<?php
13$current_path = dirname(getcwd()) . "/src/tests/" ;
14ini_set("session.save_path", $current_path);
15
16session_start(); 20session_start();
17$id = session_id(); // Get the session_id to use it later 21$id = session_id(); // Get the session_id to use it later
18$filename_sess = $current_path . "sess_" . $id; 22$filename_sess = dirname(__FILE__) . "/sess_" . $id;
19file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write a unencrypted session 23file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write unencrypted session
20session_write_close(); // Close the session 24session_write_close(); // Close the session
21 25
22session_id($id); 26session_id($id);
23session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session 27session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session
24var_dump($_SESSION); 28var_dump($_SESSION);
25echo "OK"; 29echo "OK\n";
30echo file_get_contents(dirname(__FILE__) . "/crypt_session_read_uncrypt.tmp");
31unlink(dirname(__FILE__) . "/crypt_session_read_uncrypt.tmp");
26unlink($filename_sess); 32unlink($filename_sess);
27?> 33?>
28--EXPECTF-- 34--EXPECTF--
@@ -31,3 +37,4 @@ array(1) {
31 string(4) "tata" 37 string(4) "tata"
32} 38}
33OK 39OK
40%aPHP Warning: [snuffleupagus][127.0.0.1][cookie_encryption][simulation] Buffer underflow tentative detected in cookie encryption handling for the session. Using the cookie 'as is' instead of decrypting it in %a/crypt_session_read_uncrypt.php on line 9