Review main Merged

67471[BUGFIX] Avoid access to missing mbstring functions

Simon Gilli CR +2 V +2 Easy +6 −3 updated 02/04/21, 18:26

Commit message

This patch removes usages of mbstring functions which are missing in the
fallback package symfony/polyfill-mbstring.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • Martin Kutschker +1
    • Mathias Brodala +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Markus Klein +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 1617

  1. Simon Gilli uploaded patch set 1 01/20/21, 10:05

  2. Mathias Brodala commented on patch set 1 01/20/21, 10:12

    DefaultFactory.php:255

    I guess there is no other way here: https://bugs.php.net/bug.php?id=67442&edit=3
  3. TYPO3com voted on patch set 1 V +1 01/20/21, 10:14 Completed build in 08m 58s on Wed, 20 Jan, 10:14 AM Test Summary: 32595 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8934

  4. Martin Kutschker commented on patch set 1 CR +1 01/20/21, 11:20

    DefaultFactory.php:255 Reply

    explode on 7bit data is safe for UTF8
  5. Mathias Brodala commented on patch set 1 01/20/21, 11:29

    DefaultFactory.php:255 Reply

    Sorry, I don't understand what this means. My impression was that having file paths with special Unicode characters (multi-byte) can lead to issues when explode()'d compared to mb_split()'d. Am I wrong?
  6. Simon Gilli commented on patch set 1 01/20/21, 12:14

    DefaultFactory.php:255 Reply

    "/" uses only 7 bits which can not occur in a upper byte in case of multiple bytes.
  7. Martin Kutschker commented on patch set 1 01/20/21, 12:21

    DefaultFactory.php:255 Reply

    I don't see why. No 7bit ASCII code is part of a UTF9 multi-byte sequence. So if I split an UTF8-string apart with an ASCII character then the result will always be an array of valid UTF8 strings. And even if I feed any valid UTF8 sequence as separator the result is ok. What does not work is using an 8bit code with the highest bit set (eg a latin1 umlaut). This is not valid in UTF8 and result in an array of invalid strings. The main difference is that mb_split() uses a regexp and is more akin to pre_split with the u switch.
  8. Martin Kutschker commented on patch set 1 01/20/21, 12:23

    DefaultFactory.php:255 Reply

    Ok, I have read only now the PHP tracker entry. The ticket is valid for UTF16 which is a fixed-length 2 byte encoding. explode() will also fail for CJK encodings etc. But explode() is safe for all single-byte encodings and UTF8.
  9. Martin Kutschker commented on patch set 1 CR -1 01/20/21, 12:32

    Indexer.php:1044

    There is a big difference between mb_string and mb_strcut. The latter cuts at byte position, not character position. If $maxL is measured in characters the string will be too long for the DB. I don't think that any DB other then Mysql accepts strings longer than defined without raising an error.
  10. Simon Gilli commented on patch set 1 01/20/21, 12:41

    Indexer.php:1044 Reply

    Therefor you can change the configration properly. But if the database has the correct character set this should not be an issue. It's also possible to use a 0 length in the configuration which will not truncate the string at all. Imho this is fine, see also my comment.
  11. Martin Kutschker commented on patch set 1 CR +1 01/20/21, 13:09

    Indexer.php:1044 Reply

    Ack
  12. Mathias Brodala commented on patch set 1 01/20/21, 13:22

    DefaultFactory.php:255 Reply

    Thanks for the insights. :-)
  13. Mathias Brodala voted on patch set 1 CR +1 01/20/21, 13:24

  14. Simon Gilli commented on patch set 1 01/20/21, 13:35

    There is also a discussion at Slack see https://typo3.slack.com/archives/C03AM9R17/p1611141607115400
  15. Markus Klein voted on patch set 1 V +1 CR +1 02/02/21, 13:48

  16. Christian Kuhn voted on patch set 1 V +2 CR +2 02/04/21, 18:26

  17. Christian Kuhn merged patch set 2 02/04/21, 18:26