diff options
| author | jvoisin | 2019-01-14 19:29:25 +0000 |
|---|---|---|
| committer | GitHub | 2019-01-14 19:29:25 +0000 |
| commit | e79f7e3bd992c7f0915ef9afe7afb6d79740527a (patch) | |
| tree | f881c25694eb00da2331a9ab280ec1c24a5662ab /src/tests/session_encryption/crypt_session_read_uncrypt.phpt | |
| parent | c943db586ac46b686b49bdf61d8473e39dd93000 (diff) | |
Reorganize the testsuite
Splitting the testsuite in several components makes it easier to manage and comprehend.
This was also needed some some tests aren't passing on Alpine Linux, but we still want to run
as many of them as we can on this platform.
Diffstat (limited to 'src/tests/session_encryption/crypt_session_read_uncrypt.phpt')
| -rw-r--r-- | src/tests/session_encryption/crypt_session_read_uncrypt.phpt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/session_encryption/crypt_session_read_uncrypt.phpt b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt new file mode 100644 index 0000000..f15d8b6 --- /dev/null +++ b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | --TEST-- | ||
| 2 | SESSION crypt/decrypt valid | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini | ||
| 7 | --ENV-- | ||
| 8 | return <<<EOF | ||
| 9 | REMOTE_ADDR=127.0.0.1 | ||
| 10 | EOF; | ||
| 11 | --FILE-- | ||
| 12 | <?php | ||
| 13 | $current_path = dirname(getcwd()) . "/src/tests/" ; | ||
| 14 | ini_set("session.save_path", $current_path); | ||
| 15 | |||
| 16 | session_start(); | ||
| 17 | $id = session_id(); // Get the session_id to use it later | ||
| 18 | $filename_sess = $current_path . "sess_" . $id; | ||
| 19 | file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write a unencrypted session | ||
| 20 | session_write_close(); // Close the session | ||
| 21 | |||
| 22 | session_id($id); | ||
| 23 | session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session | ||
| 24 | var_dump($_SESSION); | ||
| 25 | echo "OK"; | ||
| 26 | unlink($filename_sess); | ||
| 27 | ?> | ||
| 28 | --EXPECTF-- | ||
| 29 | array(1) { | ||
| 30 | ["toto"]=> | ||
| 31 | string(4) "tata" | ||
| 32 | } | ||
| 33 | OK | ||
