Review main Merged

47309[TASK] Use file_get_contents instead of getUrl()

Benni Mack CR +2 V +2 Normal +78 −68 updated 03/29/16, 05:24

Commit message

The method GeneralUtility::getUrl() is used a lot in the
core where only local files are allowed.

Most occurrences can be replaced by using the native
file_get_contents() PHP function.

file_get_contents() is now always used when

* is_file() is called
* only local paths (e.g. prefixed with PATH_site)
* absolute paths (GeneralUtility::getFileAbsFileName)
* ensured that files within extensions

are checked before. In these cases getUrl() MUST NOT BE
USED but built-in file_get_contents() must be used instead.

Review

  • Code review CR +2
    • Benni Mack +2
    • Daniel Gorges +1
    • Christian Kuhn +1
    • Andreas Kienast +1
    • Philipp Gampe +1
  • Verified V +2
    • Benni Mack +2
    • Daniel Gorges +1
    • Andreas Kienast +1

Issues 1

Files 30

Show 10 more files

Review log 14

  1. Benni Mack uploaded patch set 1 03/18/16, 07:54

  2. Benni Mack commented on patch set 1 CR -1 03/18/16, 08:55

    gotta check the other places as well - also need to validate the tests.
  3. Benni Mack uploaded patch set 2 03/18/16, 20:21

  4. Benni Mack uploaded patch set 3 03/18/16, 23:18

  5. Philipp Gampe commented on patch set 3 03/19/16, 18:51

    PageRenderer.php:2010

    why silence warnings?

    ExtensionCompatibilityTester.php:122

    I would prefer an is_file check here instead of hinding warnings (e.g. permission etc).

    ExtensionCompatibilityTester.php:208

    a failure to read an existing file or it's contents would be converted into an empty string here. I think any error should bubble up and be displayed to the user (who is using the install tool, thus he is a technician).
  6. Benni Mack commented on patch set 3 03/21/16, 06:20

    PageRenderer.php:2010 Reply

    we could also add a is_file() around it. But getUrl() does @ as well. so we just keep the logic as is.

    ExtensionCompatibilityTester.php:208 Reply

    you should try out the functionality and the tests :) - without the @ in front of file_get_contents(). The functionality is called even when the file is empty (behaviour as before) but then would throw a PHP warning. However the code is also executed when NO protocoFile is executed. But I think and is_file() check would do it.
  7. Benni Mack uploaded patch set 4 03/21/16, 07:15

  8. Philipp Gampe commented on patch set 4 CR +1 03/22/16, 15:09

    Thank you for updating the patch.
  9. Andreas Kienast voted on patch set 4 CR +1 03/24/16, 08:59

  10. Andreas Kienast voted on patch set 4 V +1 03/24/16, 15:35

  11. Christian Kuhn voted on patch set 4 CR +1 03/25/16, 09:12

  12. Daniel Gorges voted on patch set 4 CR +1 V +1 03/29/16, 05:21

  13. Benni Mack voted on patch set 4 CR +2 V +2 03/29/16, 05:24

  14. Gerrit merged patch set 4 03/29/16, 05:24