TYPO3 / CmsComposerInstallers

TYPO3 CMS Composer Installer
GNU General Public License v2.0
58 stars 39 forks source link

Errors on `composer update` when wrong PHP version is used #143

Closed gilbertsoft closed 1 year ago

gilbertsoft commented 1 year ago

If a user calls composer update with a not supported PHP version there may be errors while running the PackageArtifactBuilder. E.g. running Composer with PHP 7.4 and TYPO3 v12 leads to this error:

[ParseError]
syntax error, unexpected ')'
at /path_to_my_website/vendor/typo3/cms-core/Classes/Utility/PathUtility.php:167
Site is running PHP 8.2. In deed the line in PathUtility is:
$paths = array_map(GeneralUtility::fixWindowsFilePath(...), $paths);

See also https://typo3.slack.com/archives/C03AM9R17/p1683700636956399

helhum commented 1 year ago

How is it possible that Composer installs packages, that require PHP 8 with a PHP 7.4 binary in the first place? Maybe platform set to PHP 7.4? In any case, I can not reproduce. Please provide further info how to get Composer to ignore the current platform?

helhum commented 1 year ago

for the record: This might be possible to reproduced with doing composer update once with a correct PHP version and then composer du with a wrong PHP version.

The only improvement that can be done is showing a better error message. I have no clue though how to do that without replicating PHP version or cluttering the code with flaky error detection.

If someone comes up with a good idea how to achieve better errors without adding hard to maintain code, I'm fine to consider that for a merge. Until then, I'll close this here.