Changes between Initial Version and Version 1 of Ticket #46411, comment 3
- Timestamp:
- 03/04/2019 03:13:15 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #46411, comment 3
initial v1 1 The issue appears to be that the `version_compare` check fails with certain php version strings reported by `phpversion()`. 1 I incorrectly informed @cristiano.zanca that this was a bug because in the test I did I included the `PHP Version` string :( . 2 2 3 3 Example: … … 7 7 }}} 8 8 9 Reports `false`. 9 Instead, the correct test doing this: 10 10 11 So there will need to be some sanitization of the string returned by `phpversion()` 11 {{{ 12 var_dump( version_compare( '7.2.15-1+0~20190209065123.16+stretch~1.gbp3ad8c0', '7.1', '>=' ) ); 13 }}} 14 15 returns the expected `true` value. 16 17 For future proofing against possible string issues we _could_ still use the constants as mentioned below but for all intents and purposes this does not appear to be a bug right now. 12 18 13 19 Alternatively, using the php version constants might be better here: `PHP_MAJOR_VERSION`, `PHP_MINOR_VERSION`, `PHP_RELEASE_VERSION`. That will ensure we're only comparing on the important values, so something like: