Review main Merged

45326[TASK] EXT:backend Use htmlspecialchars instead of 2nd Param in getLL/sL

Michael Oehlhof CR +2 V +2 Normal +31 −31 updated 01/07/16, 21:36

Commit message

Use htmlspecialchars instead of the 2nd Parameter in getLL/sL for all
files in backend\Classes\Backend

Review

  • Code review CR +2
    • Benni Mack +2
    • Markus Klein +1
  • Verified V +2
    • Benni Mack +2
    • Markus Klein +1

Issues 1

Files 5

Review log 15

  1. Michael Oehlhof uploaded patch set 1 12/17/15, 00:47

  2. Markus Klein voted on patch set 1 CR +1 V +1 12/17/15, 11:29

  3. Jigal van Hemert commented on patch set 1 12/17/15, 17:40

    Use default htmlspecialchars() or create API? (See note)

    ClearCacheToolbarItem.php:62

    htmlspecialchars() has options to process the output according to the type of output (doctype). The PHP documentation isn't really clear, but http://stackoverflow.com/questions/13745353/what-do-the-ent-html5-ent-html401-modifiers-on-html-entity-decode-do explains a lot. If we want to use this some API methods seem appropriate.
  4. Markus Klein commented on patch set 1 12/17/15, 17:49

    ClearCacheToolbarItem.php:62 Reply

    According to your link, we have to do nothing at all. The default is save.
  5. Jigal van Hemert commented on patch set 1 12/17/15, 18:18

    ClearCacheToolbarItem.php:62 Reply

    I didn't say that it wasn't safe. The default uses ENT_HTML401 which has a very limited entity set ( https://github.com/php/php-src/blob/php-5.4.11/ext/standard/html_tables/ents_html401.txt ). If you're using HTML5 output the ENT_HTML5 would be better because it uses a huge unicode entity list ( https://github.com/php/php-src/blob/php-5.4.11/ext/standard/html_tables/ents_html5.txt )
  6. Markus Klein commented on patch set 1 12/17/15, 18:28

    ClearCacheToolbarItem.php:62 Reply

    IMO this is not about encoding stuff, but about escaping (to be on the safe side). Every browser can read utf-8 chars today, so no need to encode them in any way. If encoding is really necessary, it should be done on the final output.
  7. Michael Oehlhof commented on patch set 1 12/17/15, 22:07

    ClearCacheToolbarItem.php:62 Reply

    htmlspecialchars is called inside sL with 2nd and 3rd parameter as the default, only 4th parameter was set to false, could this be a problem here? Definition: htmlspecialchars ($string, $flags = ENT_COMPAT, $encoding = 'UTF-8', $double_encode = true) Call in sL: htmlspecialchars($output, ENT_COMPAT, 'UTF-8', false)
  8. Markus Klein commented on patch set 1 12/17/15, 22:15

    ClearCacheToolbarItem.php:62 Reply

    Good question. I traced this line back. Before the current version it was t3lib_div::deHSCentities(htmlspecialchars()) and that dates back to Kasper's Initial Commit. So how likely is it that this label contains HTML code? I'd say very unlikely, so the change should be fine.
  9. Frank Nägler voted on patch set 1 CR +1 12/18/15, 12:40

  10. Michael Oehlhof commented on patch set 1 12/22/15, 00:14

    Should this also be fixed for 7.6?
  11. Markus Klein commented on patch set 1 CR 0 V 0 12/22/15, 08:25

    No, I don't think so and I just realized that this is not a bugfix but a normal task actually.
  12. Markus Klein commented on patch set 2 12/22/15, 08:26

    Published edit on patch set 1
  13. Markus Klein voted on patch set 2 CR +1 V +1 12/22/15, 08:26

  14. Benni Mack voted on patch set 2 CR +2 V +2 01/07/16, 21:36

  15. Gerrit merged patch set 2 01/07/16, 21:36