Skip to content

Commit 738eb3c

Browse files
Run Matomo in PHP 8.3 (matomo-org#21434)
* Add extra test runner for PHP 8.3 * Fix serialised data for data table test * Add support for '-dev' PHP versions in test * Check if headers sent before setting them again * Update plugins/Marketplace/tests/Integration/EnvironmentTest.php Co-authored-by: Michal Kleiner <[email protected]> * Run UI tests with 8.3 * Run UI tests with 8.2 * Run UI tests back with 7.2 * Add 8.3 to unit/integration tests --------- Co-authored-by: Michal Kleiner <[email protected]>
1 parent c5bce87 commit 738eb3c

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

.github/workflows/matomo-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ jobs:
3737
fail-fast: false
3838
matrix:
3939
type: [ 'UnitTests', 'SystemTestsPlugins', 'SystemTestsCore', 'IntegrationTestsCore', 'IntegrationTestsPlugins' ]
40-
php: [ '7.2', '8.2' ]
40+
php: [ '7.2', '8.2', '8.3' ]
4141
adapter: [ 'PDO_MYSQL', 'MYSQLI' ]
4242
exclude:
4343
- php: '7.2'
4444
adapter: 'MYSQLI'
4545
- php: '8.2'
4646
adapter: 'PDO_MYSQL'
47+
- php: '8.3'
48+
adapter: 'PDO_MYSQL'
4749
steps:
4850
- uses: actions/checkout@v3
4951
with:

plugins/Marketplace/tests/Integration/EnvironmentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public function setUp(): void
4545

4646
public function test_getPhpVersion()
4747
{
48-
// this is because the php version contain uname
49-
$this->assertTrue(version_compare(phpversion(), $this->environment->getPhpVersion(),'>='));
48+
$phpVersion = explode('-', phpversion()); // cater for pre-release versions like 8.3.0-dev
49+
$this->assertTrue(version_compare($phpVersion[0], $this->environment->getPhpVersion(),'>='));
5050
}
5151

5252
public function test_getPiwikVersion()

plugins/TwoFactorAuth/TwoFactorAuth.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,15 @@ public function onCreateAppSpecificTokenAuth($returnedValue, $params)
179179
// we only return an error when the login/password combo was correct. otherwise you could brute force
180180
// auth tokens
181181
if (!$authCode) {
182-
http_response_code(401);
182+
if (!headers_sent()) {
183+
http_response_code(401);
184+
}
183185
throw new Exception(Piwik::translate('TwoFactorAuth_MissingAuthCodeAPI'));
184186
}
185187
if (!$twoFa->validateAuthCode($login, $authCode)) {
186-
http_response_code(401);
188+
if (!headers_sent()) {
189+
http_response_code(401);
190+
}
187191
throw new Exception(Piwik::translate('TwoFactorAuth_InvalidAuthCode'));
188192
}
189193
} else if ($twoFa->isUserRequiredToHaveTwoFactorEnabled()

tests/resources/DataTables-archived-different-formats.php

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)