diff options
| author | Ben Fuhrmannek | 2022-01-12 19:51:09 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2022-01-12 19:51:09 +0100 |
| commit | 80228c69c19b131764cd5848071d25f7ba0ad249 (patch) | |
| tree | 4a35b22dbbb34ed4f334dc8fe591b57670e917ff /src/tests/session_encryption | |
| parent | e8da4951dabcddd04c6a2e6daa0dea08003e476f (diff) | |
removed redundant tests + minor fixes
Diffstat (limited to 'src/tests/session_encryption')
10 files changed, 29 insertions, 40 deletions
diff --git a/src/tests/session_encryption/crypt_session_corrupted_session.phpt b/src/tests/session_encryption/crypt_session_corrupted_session.phpt index db3f949..eca43b4 100644 --- a/src/tests/session_encryption/crypt_session_corrupted_session.phpt +++ b/src/tests/session_encryption/crypt_session_corrupted_session.phpt | |||
| @@ -2,8 +2,9 @@ | |||
| 2 | Set a custom session handler | 2 | Set a custom session handler |
| 3 | --SKIPIF-- | 3 | --SKIPIF-- |
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> |
| 5 | <?php if (PHP_VERSION_ID >= 80000) print "skip"; ?> | 5 | <?php if (!extension_loaded("session")) print "skip"; ?> |
| 6 | <?php if (PHP_VERSION_ID >= 70400) print "skip"; ?> | 6 | --EXTENSIONS-- |
| 7 | session | ||
| 7 | --INI-- | 8 | --INI-- |
| 8 | sp.configuration_file={PWD}/config/config_crypt_session.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session.ini |
| 9 | session.save_path="/tmp" | 10 | session.save_path="/tmp" |
diff --git a/src/tests/session_encryption/crypt_session_invalid.phpt b/src/tests/session_encryption/crypt_session_invalid.phpt index 967d9d1..a71a601 100644 --- a/src/tests/session_encryption/crypt_session_invalid.phpt +++ b/src/tests/session_encryption/crypt_session_invalid.phpt | |||
| @@ -2,8 +2,9 @@ | |||
| 2 | SESSION crypt and bad decrypt | 2 | SESSION crypt and bad decrypt |
| 3 | --SKIPIF-- | 3 | --SKIPIF-- |
| 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> | 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> |
| 5 | <?php if (PHP_VERSION_ID >= 80000) print "skip"; ?> | 5 | <?php if (!extension_loaded("session")) print "skip"; ?> |
| 6 | <?php if (PHP_VERSION_ID >= 70400) print "skip"; ?> | 6 | --EXTENSIONS-- |
| 7 | session | ||
| 7 | --INI-- | 8 | --INI-- |
| 8 | sp.configuration_file={PWD}/config/config_crypt_session.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session.ini |
| 9 | --ENV-- | 10 | --ENV-- |
diff --git a/src/tests/session_encryption/crypt_session_invalid_simul.phpt b/src/tests/session_encryption/crypt_session_invalid_simul.phpt index 02db524..3eb619c 100644 --- a/src/tests/session_encryption/crypt_session_invalid_simul.phpt +++ b/src/tests/session_encryption/crypt_session_invalid_simul.phpt | |||
| @@ -1,7 +1,10 @@ | |||
| 1 | --TEST-- | 1 | --TEST-- |
| 2 | SESSION crypt and bad decrypt | 2 | SESSION crypt and bad decrypt |
| 3 | --SKIPIF-- | 3 | --SKIPIF-- |
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID < 80000) print "skip"; ?> | 4 | <?php if (!extension_loaded("snuffleupagus")) print "skip"; ?> |
| 5 | <?php if (!extension_loaded("session")) print "skip"; ?> | ||
| 6 | --EXTENSIONS-- | ||
| 7 | session | ||
| 5 | --INI-- | 8 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini |
| 7 | display_errors=0 | 10 | display_errors=0 |
| @@ -30,5 +33,4 @@ unlink(dirname(__FILE__) . "/crypt_session_invalid_simul.tmp"); | |||
| 30 | --EXPECTF-- | 33 | --EXPECTF-- |
| 31 | array(0) { | 34 | array(0) { |
| 32 | } | 35 | } |
| 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.php on line 9 | 36 | %sPHP 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.php on line 9%A \ No newline at end of file |
| 34 | %aPHP Warning: session_start(): Failed to decode session object. Session has been destroyed in %a/crypt_session_invalid_simul.php on line 9 | ||
diff --git a/src/tests/session_encryption/crypt_session_invalid_simul_php8.phpt b/src/tests/session_encryption/crypt_session_invalid_simul_php8.phpt deleted file mode 100644 index a05b828..0000000 --- a/src/tests/session_encryption/crypt_session_invalid_simul_php8.phpt +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | --TEST-- | ||
| 2 | SESSION crypt and bad decrypt | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus") || PHP_VERSION_ID >= 80000) 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 | ||
diff --git a/src/tests/session_encryption/crypt_session_read_uncrypt.phpt b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt index e2e1737..5966f8e 100644 --- a/src/tests/session_encryption/crypt_session_read_uncrypt.phpt +++ b/src/tests/session_encryption/crypt_session_read_uncrypt.phpt | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | SESSION crypt/decrypt valid | 2 | SESSION 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-- | ||
| 7 | session | ||
| 5 | --INI-- | 8 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini |
| 7 | session.save_path="{PWD}" | 10 | session.save_path="{PWD}" |
diff --git a/src/tests/session_encryption/crypt_session_valid.phpt b/src/tests/session_encryption/crypt_session_valid.phpt index c272486..a28685b 100644 --- a/src/tests/session_encryption/crypt_session_valid.phpt +++ b/src/tests/session_encryption/crypt_session_valid.phpt | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | SESSION crypt/decrypt valid | 2 | SESSION 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-- | ||
| 7 | session | ||
| 5 | --INI-- | 8 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session.ini |
| 7 | --ENV-- | 10 | --ENV-- |
diff --git a/src/tests/session_encryption/crypt_session_valid_simul.phpt b/src/tests/session_encryption/crypt_session_valid_simul.phpt index d63277d..6af015e 100644 --- a/src/tests/session_encryption/crypt_session_valid_simul.phpt +++ b/src/tests/session_encryption/crypt_session_valid_simul.phpt | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | SESSION crypt/decrypt valid | 2 | SESSION 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-- | ||
| 7 | session | ||
| 5 | --INI-- | 8 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session_simul.ini |
| 7 | --ENV-- | 10 | --ENV-- |
diff --git a/src/tests/session_encryption/set_custom_session_handler.phpt b/src/tests/session_encryption/set_custom_session_handler.phpt index 1b81a04..04edcd0 100644 --- a/src/tests/session_encryption/set_custom_session_handler.phpt +++ b/src/tests/session_encryption/set_custom_session_handler.phpt | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | Set a custom session handler | 2 | Set a custom session handler |
| 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-- | ||
| 7 | session | ||
| 5 | --INI-- | 8 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session.ini |
| 7 | session.save_path="/tmp" | 10 | session.save_path="/tmp" |
diff --git a/src/tests/session_encryption/set_custom_session_handler2.phpt b/src/tests/session_encryption/set_custom_session_handler2.phpt index 58b6595..0ebf7b6 100644 --- a/src/tests/session_encryption/set_custom_session_handler2.phpt +++ b/src/tests/session_encryption/set_custom_session_handler2.phpt | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | Set a custom session handler, twice | 2 | Set a custom session handler, twice |
| 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-- | ||
| 7 | session | ||
| 5 | --INI-- | 8 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session.ini |
| 7 | session.save_path="/tmp" | 10 | session.save_path="/tmp" |
diff --git a/src/tests/session_encryption/set_custom_session_handler_ini.phpt b/src/tests/session_encryption/set_custom_session_handler_ini.phpt index f9fbfb2..a454fc6 100644 --- a/src/tests/session_encryption/set_custom_session_handler_ini.phpt +++ b/src/tests/session_encryption/set_custom_session_handler_ini.phpt | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | Set a custom session handler | 2 | Set a custom session handler |
| 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-- | ||
| 7 | session | ||
| 5 | --INI-- | 8 | --INI-- |
| 6 | sp.configuration_file={PWD}/config/config_crypt_session.ini | 9 | sp.configuration_file={PWD}/config/config_crypt_session.ini |
| 7 | session.save_handler = | 10 | session.save_handler = |
