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

Allow PHP 8.2 #13759

Merged
merged 2 commits into from Jan 9, 2023
Merged

Conversation

cedric-anne
Copy link
Member

@cedric-anne cedric-anne commented Jan 9, 2023

Q A
Bug fix? yes/no
New feature? yes/no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #13758

Allowed PHP version has been updated in inc/define.php but not in index.php.

glpi/inc/define.php

Lines 51 to 52 in 0046d6d

define('GLPI_MIN_PHP', '7.4.0'); // Must also be changed in top of index.php
define('GLPI_MAX_PHP', '8.3.0'); // (Exclusive) Must also be changed in top of index.php

We did not detect it earlier as we are probably all using a pre-release version (that is considered as less than 8.2.0). Using -dev suffixes in comparison will prevent PHP 8.3 pre-releases to be accepted. Test will be similar to the test done in requirements checking:

$this->validated = version_compare(PHP_VERSION, sprintf('%s-dev', $min_version), '>=')
&& version_compare(PHP_VERSION, sprintf('%s-dev', $max_version), '<');
$this->validation_messages[] = $this->validated
? sprintf(__('PHP version (%s) is supported.'), PHP_VERSION)
: sprintf(__('PHP version must be between %s and %s (exclusive).'), $min_version, $max_version);

Note that checks has been refactore in main to simplify versions declaration: #13260

@cedric-anne cedric-anne self-assigned this Jan 9, 2023
@cedric-anne cedric-anne linked an issue Jan 9, 2023 that may be closed by this pull request
2 tasks
index.php Outdated
@@ -36,10 +36,10 @@
// Check PHP version not to have trouble
// Need to be the very fist step before any include
if (
version_compare(PHP_VERSION, '7.4.0', '<') ||
version_compare(PHP_VERSION, '8.2.0', '>=')
version_compare(PHP_VERSION, '7.4.0-dev', '<') ||
Copy link
Contributor

Choose a reason for hiding this comment

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

why those -dev?

Copy link
Contributor

Choose a reason for hiding this comment

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

we should have same versions ins both files

Copy link
Member Author

Choose a reason for hiding this comment

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

-dev suffixes are added during comparison in requirement check, see

$this->validated = version_compare(PHP_VERSION, sprintf('%s-dev', $min_version), '>=')
&& version_compare(PHP_VERSION, sprintf('%s-dev', $max_version), '<');
$this->validation_messages[] = $this->validated
? sprintf(__('PHP version (%s) is supported.'), PHP_VERSION)
: sprintf(__('PHP version must be between %s and %s (exclusive).'), $min_version, $max_version);

So I added -dev suffix here to do the exact same comparison.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should have same versions ins both files

That does not explain this difference

index.php Outdated Show resolved Hide resolved
index.php Outdated Show resolved Hide resolved
@trasher trasher merged commit 306cfb6 into glpi-project:10.0/bugfixes Jan 9, 2023
@cedric-anne cedric-anne deleted the 10.0/allow-php-8.2 branch January 9, 2023 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request Support for PHP 8.2.1
3 participants