summaryrefslogtreecommitdiff
path: root/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
diff options
context:
space:
mode:
authorBen Fuhrmannek2021-09-03 13:25:33 +0200
committerBen Fuhrmannek2021-09-03 13:25:33 +0200
commit2e4fda2c67ce98c9be9092effe2522c1de9f7efc (patch)
tree334d38d09c70220db4c2b3f6fd442638d305d3a7 /src/tests/session_encryption/crypt_session_read_uncrypt.phpt
parent6900dbd5573d7ddb04c2ccb59a4aefca841e124b (diff)
fixed session encryption in php8 + related test cases
Diffstat (limited to 'src/tests/session_encryption/crypt_session_read_uncrypt.phpt')
-rw-r--r--src/tests/session_encryption/crypt_session_read_uncrypt.phpt16
1 files changed, 10 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..e2e1737 100644
--- a/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
+++ b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt
@@ -4,25 +4,28 @@ SESSION crypt/decrypt valid
4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> 4<?php if (!extension_loaded("snuffleupagus")) print "skip"; ?>
5--INI-- 5--INI--
6sp.configuration_file={PWD}/config/config_crypt_session_simul.ini 6sp.configuration_file={PWD}/config/config_crypt_session_simul.ini
7session.save_path="{PWD}"
8display_errors=0
9log_errors=1
10error_log="{PWD}"/crypt_session_read_uncrypt.tmp
7--ENV-- 11--ENV--
8return <<<EOF 12return <<<EOF
9REMOTE_ADDR=127.0.0.1 13REMOTE_ADDR=127.0.0.1
10EOF; 14EOF;
11--FILE-- 15--FILE--
12<?php 16<?php
13$current_path = dirname(getcwd()) . "/src/tests/" ;
14ini_set("session.save_path", $current_path);
15
16session_start(); 17session_start();
17$id = session_id(); // Get the session_id to use it later 18$id = session_id(); // Get the session_id to use it later
18$filename_sess = $current_path . "sess_" . $id; 19$filename_sess = dirname(__FILE__) . "/sess_" . $id;
19file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write a unencrypted session 20file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write unencrypted session
20session_write_close(); // Close the session 21session_write_close(); // Close the session
21 22
22session_id($id); 23session_id($id);
23session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session 24session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session
24var_dump($_SESSION); 25var_dump($_SESSION);
25echo "OK"; 26echo "OK\n";
27echo file_get_contents(dirname(__FILE__) . "/crypt_session_read_uncrypt.tmp");
28unlink(dirname(__FILE__) . "/crypt_session_read_uncrypt.tmp");
26unlink($filename_sess); 29unlink($filename_sess);
27?> 30?>
28--EXPECTF-- 31--EXPECTF--
@@ -31,3 +34,4 @@ array(1) {
31 string(4) "tata" 34 string(4) "tata"
32} 35}
33OK 36OK
37%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