Review main Merged

67371[TASK] Use Composer runtime platform check instead of our own

Helmut Hummel CR +2 V +2 Easy +6 −26 updated 07/26/21, 16:36

Commit message

Several benefits come (basically for free) with this change.

1. We only maintain platform dependencies in composer.json
2. Advanced users can omit the runtime check from being generated
3. Relying on canonical functionality instead of our own

For this to work, Composer 2.0 must be required not only for
development, but also for any production install of the packages.

With doing so, eventually other runtime functionality like installed
package versions can be used as well.

composer req composer-runtime-api:^2.0

This also remove the upper version check for PHP <9
because Composer runtime API does not provide upper bound checks,
to allow future compatiblity of software installs, in case it isn't
updated any more, but would run with later PHP versions.

Upper PHP version check and failing with an appropriate error message
is useful for cases when users accidentally use a PHP version
higher than TYPO3 is capable of running on. However not only isn't
there a PHP version 9 on the horizon, it isn't even remotely clear,
whether this PHP version would have a compatiblity impact on TYPO3.

Therefore an upper version check at this point in time provides zero
value and can be safely omitted.

Besides that, also from a maintainer perspective it will be much easier
to check the impact on PHP 9 release candidates, because tests could be run
automatically against this version, without modifying the code, so that
compatiblity with this future PHP version can be provided ahead of time,
making the upper bound check obsolete as well.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Benni Mack +2
    • Simon Gilli +1
    • Markus Klein +1
    • Christian Kuhn +1
    • Xavier Perseguers +1
    • Mathias Brodala +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Benni Mack +2
    • Simon Gilli +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 7

Review log 4249

Show 2024 earlier messages
  1. Helmut Hummel uploaded patch set 1 01/10/21, 00:16

  2. Helmut Hummel updated the commit message in patch set 2 01/10/21, 00:19

  3. Helmut Hummel updated the commit message in patch set 3 01/10/21, 00:21

  4. Richard Haeser commented on patch set 3 01/10/21, 00:30

    Seems nice! As I'm not that into the runtime platform check, does this still work when you have a non-composer-based installation?
  5. TYPO3com voted on patch set 1 V +1 01/10/21, 00:33 Completed build in 16m 34s on Sun, 10 Jan, 12:33 AM Test Summary: 32569 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8786

  6. TYPO3com voted on patch set 2 V +1 01/10/21, 00:39 Completed build in 12m 13s on Sun, 10 Jan, 12:39 AM Test Summary: 32569 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8787

  7. TYPO3com voted on patch set 3 V +1 01/10/21, 00:43 Completed build in 16m 12s on Sun, 10 Jan, 12:43 AM Test Summary: 32569 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8788

  8. Simon Gilli voted on patch set 3 CR +1 01/10/21, 09:05

  9. Simon Gilli commented on patch set 3 01/10/21, 09:46

    Reply

    Yes. Finally it's all Composer, one managed by the core, the other managed by the user directly.
  10. Simon Gilli commented on patch set 3 01/10/21, 09:58

    Lower bound check works correctly and shows a useful merror message. Because of the platform.php value no error is shown during composer runtime, is this what we want?
  11. Mathias Brodala commented on patch set 3 01/11/21, 07:29

    Shouldn't we include cli.php too like in https://review.typo3.org/c/Packages/TYPO3.CMS/+/67365 ?
  12. Simon Gilli commented on patch set 3 01/11/21, 11:14

    Reply

    Everything which uses the vendor/autoload.php will have the check included automatically.
  13. Mathias Brodala commented on patch set 3 01/11/21, 11:22

    Reply

    Ah yes, of course. In this case it makes sense that cli.php is left unchanged since it's missing the version check so far.
  14. Mathias Brodala commented on patch set 3 V -1 CR +1 01/11/21, 11:35

    Works with PHP 7.2: > Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.2.30-1+ubuntu18.04.1+deb.sury.org+1. in /.../vendor/composer/platform_check.php on line 24 Fails with PHP 8.0: > Fatal error: Uncaught TYPO3\CMS\Core\Error\Exception: PHP Warning: Undefined array key "type" in /.../typo3/sysext/core/Classes/Error/DebugExceptionHandler.php line 418 in /.../typo3/sysext/core/Classes/Error/ErrorHandler.php:133 Stack trace: #0 /.../typo3/sysext/core/Classes/Error/DebugExceptionHandler.php(418): TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'Undefined array...', '/var/www/html/m...', 418) #1 /.../typo3/sysext/core/Classes/Error/DebugExceptionHandler.php(167): TYPO3\CMS\Core\Error\DebugExceptionHandler->getBacktraceCode(Array) #2 /.../typo3/sysext/core/Classes/Error/DebugExceptionHandler.php(97): TYPO3\CMS\Core\Error\DebugExceptionHandler->getSingleThrowableContent(Object(TYPO3\CMS\Core\Error\Exception), 1, 1) #3 /.../typo3/sysext/core/Classes/Error/DebugExceptionHandler.php(47): TYPO3\CMS\Core\Error\DebugExceptionHandler->getContent(Object(TYPO3\CMS\Core\Error\Exception)) #4 /.../typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php(56): TYPO3\CMS\Core\Error\DebugExceptionHandler->echoExceptionWeb(Object(TYPO3\CMS\Core\Error\Exception)) #5 [internal function]: TYPO3\CMS\Core\Error\AbstractExceptionHandler->handleException(Object(TYPO3\CMS\Core\Error\Exception)) #6 {main} thrown in /.../typo3/sysext/core/Classes/Error/ErrorHandler.php on line 133 This was already reported by Helmut: https://github.com/composer/composer/issues/9596
  15. Simon Gilli commented on patch set 3 01/11/21, 11:52

    Reply Unresolved

    Yes, as said by Helmut before the upper check is missing currently. I see you found the related composer issue.
  16. Simon Gilli commented on patch set 3 01/11/21, 11:54

    Another side note: we should wait with this patch until composer/installers v2 is released. See also https://github.com/composer/installers/issues/470.
  17. Simon Gilli commented on patch set 3 01/11/21, 12:07

  18. Simon Gilli updated the commit message in patch set 4 01/11/21, 12:08

  19. Simon Gilli voted on patch set 4 V -1 CR +1 01/11/21, 12:09

  20. TYPO3com voted on patch set 4 V +1 01/11/21, 12:18 Completed build in 10m 16s on Mon, 11 Jan, 12:18 PM Test Summary: 32569 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8807

  21. Helmut Hummel commented on patch set 4 01/11/21, 14:24

    How does this relate to composer/installers? Why did you vote -1 verified? What exactly does not work?
  22. Mathias Brodala commented on patch set 4 01/11/21, 14:31

    Reply

    Answering on my behalf: I did vote V-1 in light of https://forge.typo3.org/issues/93246 but I just noticed that you have created a separate ticket with a different topic.
  23. Mathias Brodala commented on patch set 4 V -1 01/15/21, 15:41

    As mentioned before: my original intention (prevent execution on PHP 8) is not solved by this. Also in the meantime https://github.com/composer/composer/issues/9596 has been rejected so I think we need to continue with our custom check instead.
  24. Simon Gilli commented on patch set 4 V 0 01/15/21, 15:44

    Reply Unresolved

    Increasing the req to Composer 2 will make some packages unusable because of the linked issue of composer/installers. The -1 vote was just because of Mathias' vote before which he already explained and which was removed by my change in the commit message.
  1. Helmut Hummel uploaded patch set 5 07/21/21, 11:35

  2. core-ci voted on patch set 5 V +1 07/21/21, 11:55 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13621

  3. Xavier Perseguers commented on patch set 5 07/21/21, 12:04

    Unresolved

    fauling => failing
  4. Benni Mack commented on patch set 5 07/21/21, 12:05

    Nice work. Should we go with 2.1.0 instead? seeing the composer.lock used the composer-runtime-version 2.1 already.
  5. Benni Mack commented on patch set 5 07/21/21, 12:06

    Reply

    is this still a problem for us?
  6. Simon Gilli commented on patch set 5 07/21/21, 12:43

    Reply

    Yes, as long as there is no v2 release for the composer/installers package or Aimeos doesn't provide a separate installer there will still be an issue.
  7. Simon Gilli voted on patch set 5 CR +1 07/21/21, 13:18

  8. Markus Klein commented on patch set 5 CR +1 07/21/21, 14:06

    makes sense to me
  9. Christian Kuhn commented on patch set 5 07/21/21, 16:37

    [FEATURE] seems a bit misleading and should have a feature.rst. Make it [TASK] instead?
  10. Christian Kuhn updated the commit message in patch set 6 07/21/21, 16:40

  11. core-ci voted on patch set 6 V +1 07/21/21, 16:52 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13638

  12. Xavier Perseguers commented on patch set 6 CR -1 07/21/21, 18:04

    Since commit message was updated but my (small) comment forgotten, adding a -1 to make it more visible :)
  13. Christian Kuhn updated the commit message in patch set 7 07/21/21, 21:06

  14. Christian Kuhn commented on patch set 7 07/21/21, 21:07

    Reply

    Edited the commit message for you convenience, Xavier.
  15. core-ci voted on patch set 7 V +1 07/21/21, 21:17 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/13641

  16. Xavier Perseguers commented on patch set 7 CR +1 07/22/21, 05:11

    Thx Lolli 😉
  17. Markus Klein voted on patch set 7 CR +1 07/22/21, 06:19

  18. Christian Kuhn voted on patch set 7 V +1 CR +1 07/22/21, 09:53

  19. Helmut Hummel commented on patch set 7 07/22/21, 17:03

    Reply

    I think it would make sense to use 2.1 once we rely on 2.1 runtime features, which this change does not introduce yet
  20. Benni Mack commented on patch set 7 V +2 CR +2 07/26/21, 13:35

    @simongilli: Composer Installers 2.0 is on the way, I think we can continue here.
  21. Mathias Brodala voted on patch set 7 CR +1 07/26/21, 13:38

  22. Simon Gilli commented on patch set 7 V +1 CR +1 07/26/21, 16:08

    Reply

    Alpha is out now see https://github.com/composer/installers/issues/470. So the issue should be solved very soon.
  23. Simon Gilli commented on patch set 7 07/26/21, 16:09

    Reply

    Yes agree. Also posted now, didn't see your comment before.
  24. Helmut Hummel voted on patch set 7 V +2 CR +2 07/26/21, 16:36

  25. Helmut Hummel merged patch set 8 07/26/21, 16:36