- Issue created by @maxilein
- 🇦🇹Austria maxilein
Changing to critical since my suggested fix did not work.
The message is still there. And blocks update.php - 🇦🇹Austria maxilein
Investigating further this is the message in extend list:
This module requires PHP version 8.30000000000000071054274.* and is incompatible with PHP version 8.3.6.
I have a precision of 24 set in php.ini, because we need large numbers.
- 🇦🇹Austria maxilein
changing php: 8.3 to 8.3.6 makes the error go away.
Where is that check done?
I'd like to make sure that other modules can handle it correctly. - Status changed to Postponed: needs info
12 months ago 12:03am 22 July 2024 - 🇦🇺Australia acbramley
I cannot reproduce this on 8.3 with Diff 2.x.
Can you please try to reproduce this with a vanilla Drupal installation.
- 🇦🇹Austria maxilein
Hi,
this is the important difference: I have a precision = 24 (instead of default of 14) set in php.ini
You have to restart apache afterwards.Where is the code that checks the php version in diff? I could not find it.
- Status changed to Active
12 months ago 10:50pm 22 July 2024 - 🇦🇺Australia acbramley
All version comparison code is in drupal core
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/syste...
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/syste... - 🇦🇹Austria maxilein
// Ensure this module is compatible with the currently installed version of PHP. if (version_compare(phpversion(), $module->info['php']) < 0) { $compatible = FALSE; $required = $module->info['php'] . (substr_count($module->info['php'], '.') < 2 ? '.*' : ''); $reasons[] = $this->t('This module requires PHP version @php_required and is incompatible with PHP version @php_version.', [ '@php_required' => $required, '@php_version' => phpversion(), ]); }
- 🇦🇹Austria maxilein
Maybe this helps https://stackoverflow.com/questions/10997482/php-version-compare-returns...
and this https://www.php.net/manual/en/function.phpversion.phpBut I really don't understand where the extended float digits are coming from ...
- 🇦🇹Austria maxilein
Another good source that may help for formulating a guide for floats and decimals in code and projects.
https://stackoverflow.com/questions/14587290/can-i-rely-on-php-php-ini-p...
- 🇦🇺Australia dpi Perth, Australia
Marking a similar issue in Scheduled Transitions as duplicate.
User reports issues where the patch PHP version they have should match the minimum patch version.
--
My initial thought on this from the ST issue is it could be a YAML implementation issue; a difference between PHP YAML or YAML package.
Could also be some kind of strict typing thing where the `php` value of info.yml should be stringed after read.
But precision sounds like more of a clue.
- 🇦🇺Australia mstrelan
The Yaml decoder is interpreting the version as a float:
$ drush php:cli Psy Shell v0.12.9 (PHP 8.4.8 — cli) by Justin Hileman Drush Site-Install (Drupal 11.3-dev) > var_dump(\Drupal\Core\Serialization\Yaml::decode(file_get_contents('modules/contrib/diff/diff.info.yml'))['php']); float(8.1)
With precision 14:
> \Drupal\Core\Serialization\Yaml::decode('php: 8.1')['php'];
= 8.1
With precision 17 (or above):
> \Drupal\Core\Serialization\Yaml::decode('php: 8.1')['php']; = 8.0999999999999996
If the version in info.yml file is wrapped in quotes then it is interpreted as a string.
> var_dump(\Drupal\Core\Serialization\Yaml::decode('php: "8.1"')['php']); string(3) "8.1"
So we can either fix the yaml decoder, cast the version to a string in the
version_compare
, or wrap the PHP version in quotes. - 🇦🇺Australia mstrelan
I think we should probably validate the Yaml and cast to the correct type in
\Drupal\Core\Extension\ExtensionList::createExtensionInfo
. Moving to extension component. Haven't looked for duplicates.