diff options
Diffstat (limited to 'src/tests/session_encryption/crypt_session_invalid_simul_php73.phpt')
| -rw-r--r-- | src/tests/session_encryption/crypt_session_invalid_simul_php73.phpt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/session_encryption/crypt_session_invalid_simul_php73.phpt b/src/tests/session_encryption/crypt_session_invalid_simul_php73.phpt new file mode 100644 index 0000000..4d1f747 --- /dev/null +++ b/src/tests/session_encryption/crypt_session_invalid_simul_php73.phpt | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | --TEST-- | ||
| 2 | SESSION crypt and bad decrypt | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID >= 70400) print "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini | ||
| 7 | display_errors=0 | ||
| 8 | log_errors=1 | ||
| 9 | error_log="{PWD}"/crypt_session_invalid_simul.tmp | ||
| 10 | --ENV-- | ||
| 11 | return <<<EOF | ||
| 12 | REMOTE_ADDR=127.0.0.1 | ||
| 13 | EOF; | ||
| 14 | --FILE-- | ||
| 15 | <?php | ||
| 16 | // Do it like that to write (encrypt) the session and then to read (decrypt) the session | ||
| 17 | session_start(); // Start new_session , it will read an empty session | ||
| 18 | $_SESSION["toto"] = "tata"; // Encrypt and write the session | ||
| 19 | $id = session_id(); // Get the session_id to use it later | ||
| 20 | session_write_close(); // Close the session | ||
| 21 | putenv("REMOTE_ADDR=127.0.0.2"); | ||
| 22 | session_id($id); // Recover the session with the previous session_id | ||
| 23 | session_start(); // Re start the session, It will read and decrypt the non empty session | ||
| 24 | var_dump($_SESSION); // Dump the session | ||
| 25 | |||
| 26 | echo file_get_contents(dirname(__FILE__) . "/crypt_session_invalid_simul.tmp"); | ||
| 27 | unlink(dirname(__FILE__) . "/crypt_session_invalid_simul.tmp"); | ||
| 28 | |||
| 29 | ?> | ||
| 30 | --EXPECTF-- | ||
| 31 | array(0) { | ||
| 32 | } | ||
| 33 | %aPHP Warning: [snuffleupagus][127.0.0.2][cookie_encryption][simulation] Something went wrong with the decryption of the session. Using the cookie 'as is' instead of decrypting it in %a/crypt_session_invalid_simul%a.php on line 9 | ||
