Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for PHP version above 8.0.0 #16536

Closed
wants to merge 1 commit into from
Closed

Check for PHP version above 8.0.0 #16536

wants to merge 1 commit into from

Conversation

luggesexe
Copy link
Contributor

Issue #16530

$piwik_currentPHPVersion = PHP_VERSION;
$minimumPhpInvalid = version_compare($piwik_minimumPHPVersion, $piwik_currentPHPVersion) > 0;
$maximumPHPInvalid = version_compare($piwik_maximumPHPVersion, $piwik_currentPHPVersion) >= 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait... no
$maximumPHPInvalid = version_compare($piwik_maximumPHPVersion, $piwik_currentPHPVersion) <= 0;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that syntax is really confusing, so I'd go with the alternative one: (I hope I didn't mix it up)
https://www.php.net/manual/en/function.version-compare.php

$maximumPHPInvalid = version_compare($piwik_maximumPHPVersion, $piwik_currentPHPVersion, '>='); 

Copy link
Contributor Author

@luggesexe luggesexe Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be
$maximumPHPInvalid= version_compare($piwik_maximumPHPVersion, $piwik_currentPHPVersion, '<='); as we are checking if the version is below 8.0.0 rather than above. Otherwise this option should clear things up, yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are of course right.

@@ -22,14 +22,21 @@
// 3) composer.json (in two places)
// 4) tests/PHPUnit/Integration/ReleaseCheckListTest.php
$piwik_minimumPHPVersion = '7.2.5';
$piwik_maximumPHPVersion = '8.0.0';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers @luggesexe would it need to be 8.0.0-dev? so it also matches PHP 8 beta versions etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this should work. I will add it.

@Findus23
Copy link
Member

Findus23 commented Oct 6, 2020

As this is a message that is probably shown to non-technical users (e.g. on shared hosting setting up Matomo for the first time), would it maybe make sense to make it translatable?
Or is this running before the localisation system has been initialized?

The code obviously has to run before everything else, so that wouldn't work.

@luggesexe
Copy link
Contributor Author

As this is a message that is probably shown to non-technical users (e.g. on shared hosting setting up Matomo for the first time), would it maybe make sense to make it translatable? Or is this running before the localisation system has been initialized?
The code obviously has to run before everything else, so that wouldn't work.

Yes, it runs before anything else, therefore it wouldn't be possible to translate it. Maybe adding a sentence referencing a help article?

@luggesexe luggesexe marked this pull request as draft October 6, 2020 19:31
@luggesexe luggesexe marked this pull request as ready for review October 6, 2020 19:35
@tsteur tsteur added the Needs Review PRs that need a code review label Oct 6, 2020
@tsteur tsteur added this to the 3.14.2 milestone Oct 6, 2020
@sgiehl
Copy link
Member

sgiehl commented Oct 8, 2020

closing in favor of #16539. Also the source repo is not available anymore...

@sgiehl sgiehl closed this Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants