From eba320e22bac6dd324487dbfc27f438cf5ce9de5 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sat, 13 Jan 2024 19:36:03 +0200 Subject: [PATCH 1/5] Switches to ubuntu-latest as base os ver --- .github/workflows/test-phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index 81e4dc5e269..ce01a82991a 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -7,7 +7,7 @@ permissions: jobs: tests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, '[ci skip]')" env: PHP_INI_VALUES: assert.exception=1, zend.assertions=1 From 73d3d649a545272b7c445baa5047c4f4998b6c9b Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sat, 13 Jan 2024 19:37:21 +0200 Subject: [PATCH 2/5] Using a more widely available cipher & mode for test_initialize_encrypt_decrypt() (newer PHP versions) --- tests/codeigniter/libraries/Encryption_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php index 68bc3d804dc..9bb4ff1d934 100644 --- a/tests/codeigniter/libraries/Encryption_test.php +++ b/tests/codeigniter/libraries/Encryption_test.php @@ -208,7 +208,7 @@ public function test_initialize_encrypt_decrypt() $this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message))); // Try DES in ECB mode, just for the sake of changing stuff - $this->encryption->initialize(array('cipher' => 'des', 'mode' => 'ecb', 'key' => substr($key, 0, 8))); + $this->encryption->initialize(array('cipher' => 'tripledes', 'mode' => 'ofb', 'key' => substr($key, 0, 8))); $this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message))); } From 7060216f4d030c1a2f24a404ac6fd4408588e0b6 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sat, 13 Jan 2024 19:38:43 +0200 Subject: [PATCH 3/5] Encryption_test should be considered a skipped test in older versions of PHP, which run on ubuntu-latest on GHA ... or maybe until a better approach is found --- tests/codeigniter/libraries/Encryption_test.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php index 9bb4ff1d934..40b746ffdbf 100644 --- a/tests/codeigniter/libraries/Encryption_test.php +++ b/tests/codeigniter/libraries/Encryption_test.php @@ -5,6 +5,11 @@ class Encryption_test extends CI_TestCase { public function set_up() { $this->encryption = new Mock_Libraries_Encryption(); + + if (version_compare(PHP_VERSION, '7.1', '<')) + { + $this->markTestSkipped('Ubuntu-latest OpenSSL is not working correct in some older PHP versions.'); + } } // -------------------------------------------------------------------- From d1a488a97d2a46f940c1f7cda66c4319ea7b495c Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sat, 13 Jan 2024 19:46:43 +0200 Subject: [PATCH 4/5] [ci skip] Adapting the php comment on assert --- tests/codeigniter/libraries/Encryption_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php index 40b746ffdbf..dca2acad391 100644 --- a/tests/codeigniter/libraries/Encryption_test.php +++ b/tests/codeigniter/libraries/Encryption_test.php @@ -212,7 +212,7 @@ public function test_initialize_encrypt_decrypt() $this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message))); - // Try DES in ECB mode, just for the sake of changing stuff + // Try DES3 in OFB mode, just for the sake of changing stuff $this->encryption->initialize(array('cipher' => 'tripledes', 'mode' => 'ofb', 'key' => substr($key, 0, 8))); $this->assertEquals($message, $this->encryption->decrypt($this->encryption->encrypt($message))); } From 7d2fbce9e70022f6855cbd52a190d63f16b2a5a2 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Sun, 14 Jan 2024 03:00:05 +0200 Subject: [PATCH 5/5] [ci skip] hardcoding the ubuntu version for better predictability --- .github/workflows/test-phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index ce01a82991a..c660b937e04 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -7,7 +7,7 @@ permissions: jobs: tests: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: "!contains(github.event.head_commit.message, '[ci skip]')" env: PHP_INI_VALUES: assert.exception=1, zend.assertions=1