Review main Merged

87771[BUGFIX] Gracefully handle invalid punycode domains in URI parsing

Benjamin Franzke CR +2 V +2 Easy +29 −1 updated 01/17/25, 07:54

Commit message

URLs may contain hostnames that look like punycode, but contain
invalid chars. `idn_to_ascii` reports `false` in this case.
The Hostname is therefore to be interpreted as ascii and can be passed
to `filter_var` for validation without modification.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Oliver Hader +1
    • Benni Mack +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Oliver Hader +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 1314

  1. Benjamin Franzke uploaded patch set 1 01/15/25, 10:51

  2. core-ci voted on patch set 1 V +1 01/15/25, 10:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72513

  3. Benjamin Franzke commented on patch set 1 01/15/25, 11:03

    Uri.php:195

    We still need to figure out why phpstan did not complain about the `string|false` assignment to a `string` property, the phpstan stub for `idn_to_ascii` looks ok: https://github.com/phpstan/php-8-stubs/blob/c7062f5a08cad486882957ac80028e507177c885/stubs/ext/intl/idn_to_ascii.php
  4. Andreas Kienast voted on patch set 1 CR +1 V +1 01/15/25, 11:08

  5. Benjamin Franzke commented on patch set 1 01/15/25, 11:08

    Uri.php:195 Reply

    Requires phpstan level 7 instead of 5.
  6. Oliver Hader voted on patch set 1 CR +1 01/15/25, 11:36

  7. Oliver Hader commented on patch set 1 CR 0 01/15/25, 11:45

    UriTest.php:607

    I did not find a test-case checking for e.g. `new Uri('https://tüpö3.org')`...
  8. Benjamin Franzke commented on patch set 1 01/15/25, 12:01

    UriTest.php:607 Reply

    Line 516, added with: > 87049: [TASK] Increase Uri test coverage | https://review.typo3.org/c/Packages/TYPO3.CMS/+/87049
  9. Oliver Hader commented on patch set 1 01/16/25, 13:01

    UriTest.php:607 Reply

    Acknowledged
  10. Oliver Hader voted on patch set 1 CR +1 01/16/25, 13:01

  11. Oliver Hader voted on patch set 1 V +1 01/16/25, 14:48

  12. Benni Mack voted on patch set 1 CR +1 V +1 01/16/25, 15:00

  13. Benjamin Franzke voted on patch set 1 CR +2 V +2 01/16/25, 16:07

  14. Benjamin Franzke merged patch set 2 01/17/25, 07:54