diff options
Diffstat (limited to 'src/tests/session_encryption/crypt_session_read_uncrypt.phpt')
| -rw-r--r-- | src/tests/session_encryption/crypt_session_read_uncrypt.phpt | 16 |
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-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini | 6 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini |
| 7 | session.save_path="{PWD}" | ||
| 8 | display_errors=0 | ||
| 9 | log_errors=1 | ||
| 10 | error_log="{PWD}"/crypt_session_read_uncrypt.tmp | ||
| 7 | --ENV-- | 11 | --ENV-- |
| 8 | return <<<EOF | 12 | return <<<EOF |
| 9 | REMOTE_ADDR=127.0.0.1 | 13 | REMOTE_ADDR=127.0.0.1 |
| 10 | EOF; | 14 | EOF; |
| 11 | --FILE-- | 15 | --FILE-- |
| 12 | <?php | 16 | <?php |
| 13 | $current_path = dirname(getcwd()) . "/src/tests/" ; | ||
| 14 | ini_set("session.save_path", $current_path); | ||
| 15 | |||
| 16 | session_start(); | 17 | session_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; |
| 19 | file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write a unencrypted session | 20 | file_put_contents($filename_sess, "toto|s:4:\"tata\";"); // Write unencrypted session |
| 20 | session_write_close(); // Close the session | 21 | session_write_close(); // Close the session |
| 21 | 22 | ||
| 22 | session_id($id); | 23 | session_id($id); |
| 23 | session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session | 24 | session_start(); // Try to read the unencrypted session, it will fail to decrypt but it must return the session |
| 24 | var_dump($_SESSION); | 25 | var_dump($_SESSION); |
| 25 | echo "OK"; | 26 | echo "OK\n"; |
| 27 | echo file_get_contents(dirname(__FILE__) . "/crypt_session_read_uncrypt.tmp"); | ||
| 28 | unlink(dirname(__FILE__) . "/crypt_session_read_uncrypt.tmp"); | ||
| 26 | unlink($filename_sess); | 29 | unlink($filename_sess); |
| 27 | ?> | 30 | ?> |
| 28 | --EXPECTF-- | 31 | --EXPECTF-- |
| @@ -31,3 +34,4 @@ array(1) { | |||
| 31 | string(4) "tata" | 34 | string(4) "tata" |
| 32 | } | 35 | } |
| 33 | OK | 36 | OK |
| 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 | ||
