Review main Merged

59395[BUGFIX] Fix return type of determineSiteScript

Harald Atteneder CR +2 V +2 Easy +11 −1 updated 02/01/19, 16:43

Commit message

substr returns a boolean instead of an empty string. A typecast fixes
this problem (See http://php.net/manual/de/function.substr.php#90369)

Review

  • Code review CR +2
    • Anja Leichsenring +2
    • Oliver Klee +1
    • Alexander Schnitzler +1
    • Susi Moog +1
  • Verified V +2
    • Anja Leichsenring +2
    • Alexander Schnitzler +1
    • Susi Moog +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 2226

Show 1 earlier messages
  1. Harald Atteneder uploaded patch set 1 01/10/19, 10:33

  1. TYPO3com voted on patch set 1 V -1 01/10/19, 10:33 Completed build in 10s on Thu, 10 Jan, 11:33 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-31392

  2. Georg Ringer commented on patch set 2 01/10/19, 11:09

    Published edit on patch set 1.
  3. Oliver Klee updated the commit message in patch set 3 01/10/19, 11:19

  4. Oliver Klee voted on patch set 3 CR +1 01/10/19, 11:20

  5. Josef Glatz voted on patch set 3 CR +1 01/10/19, 11:25

  6. TYPO3com voted on patch set 2 V +1 01/10/19, 11:25 Completed build in 15m 26s on Thu, 10 Jan, 12:25 PM Test Summary: 47625 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-31394

  7. TYPO3com voted on patch set 3 V +1 01/10/19, 11:33 Completed build in 12m 06s on Thu, 10 Jan, 12:33 PM Test Summary: 47625 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-31396

  8. Alexander Schnitzler voted on patch set 3 V +1 CR +1 01/10/19, 12:39

  9. Christian Kuhn commented on patch set 3 01/10/19, 13:17

    Is it possible to trigger the issue with a unit test? NormalizedParams has high test coverage, so it seems there is just one test missing? Basically, a unit test should show that it fails without the string cast and is green if it is added.
  10. Christian Kuhn commented on patch set 3 CR -1 01/10/19, 13:24

    maybe i can come up with something.
  11. Christian Kuhn commented on patch set 3 01/10/19, 13:42

    i don't get it. first, if i execute locally: var_dump(substr('123456', 6)); then it DOES return an empty string as result. i also added a test set (without the string cast) to NormalizedParams method getSiteScriptReturnsExpectedPathDataProvider() and it is green without the patch: 'no path' => [ [ 'SCRIPT_NAME' => '', 'HTTP_HOST' => 'www.domain.com', ], '/var/www/myInstance/Web/', '/var/www/myInstance/Web', '' ], What am i doing wrong to trigger the issue?
  12. Alexander Schnitzler commented on patch set 3 01/10/19, 13:58

    To be clear on this one: I did not test this with actual input variables. The mere fact, that substr can return false made me check that var_dump((string)false); returns an empty string and is therefore compatible with the return type and never throws a TypeError here. I personally don't need a test here because I don't know what exactly triggers substr to return a bool but as it is possible in general and conflicts with the return type contract I'd merge that.
  13. Christian Kuhn commented on patch set 3 01/10/19, 15:42

    Still, I think it would be useful to know how exactly such a scenario can be produced. For me, $requestUrl is always at least as long as or longer than $siteUrl.
  14. Harald Atteneder commented on patch set 3 01/10/19, 19:19

    > Still, I think it would be useful to know how exactly such a > scenario can be produced. For me, $requestUrl is always at least as > long as or longer than $siteUrl. Steps to reproduce: 1. Web server uses /html/ as web root. Due to hosting limitations this can not be changed 2. Install TYPO3 via composer inside /html/ 3. Create /html/.htaccess to rewrite all URLs to /html/public/ since this is where composer install the index.php of TYPO3 Contents of .htaccess: ``` RewriteEngine on RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L] ``` 4. When visiting the frontend, you get the error message mentioned here: https://forge.typo3.org/issues/87387 $requestUrl: "http://domain.tld/"; $siteUrl: "http://domain.tld/public/";
  15. Alexander Schnitzler uploaded patch set 4 01/15/19, 14:10

  16. Alexander Schnitzler commented on patch set 4 01/15/19, 14:11

    @Harald: Can you please check that the data I used in the unit test matches your setup and use case?
  17. TYPO3com voted on patch set 4 V +1 01/15/19, 14:25 Completed build in 14m 53s on Tue, 15 Jan, 03:25 PM Test Summary: 47550 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-31523

  18. Harald Atteneder commented on patch set 4 01/18/19, 12:20

    > @Harald: > Can you please check that the data I used in the unit test matches > your setup and use case? Here are some of my server vars: REQUEST_URI="/" SCRIPT_NAME="/public/index.php" HTTP_HOST="www.domain.com" SCRIPT_FILENAME="/var/www/html/public/index.php" SCRIPT_NAME="/public/index.php" DOCUMENT_ROOT="/var/www/html/" CWD="/public/" Here is my .htaccess RewriteEngine on RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L] I hope that helps…
  19. Susi Moog commented on patch set 4 V +1 CR +1 01/22/19, 18:02

    Patch verified via the Unit Test and manual testing with instructions provided.
  20. Alexander Schnitzler voted on patch set 4 V +1 CR +1 01/22/19, 22:24

  21. Oliver Klee voted on patch set 4 CR +1 01/22/19, 23:03

  22. Josef Glatz wrote 01/24/19, 06:14

    Removed reviewer Josef Glatz.
  23. Anja Leichsenring voted on patch set 4 V +2 CR +2 02/01/19, 16:43

  24. Anja Leichsenring merged patch set 5 02/01/19, 16:43

  25. Anja Leichsenring commented on patch set 5 02/01/19, 16:43

    Cherry Picked This patchset was cherry picked to branch 9.5 as commit e7c3efdd5b63e069c9b09b96a50fc277377fcdca