Review TYPO3_7-6 Merged

51815[BUGFIX] Fix non-302 redirects for PSR-7 response objects

Susi Moog CR +2 V +2 Easy +4 −3 updated 02/26/17, 16:50

Commit message

All redirect status codes (e.g. 201,301,303,307) are incorrectly
sent as 302.

We need to set the response code before setting the Location header,
as a call to header('Location: ...'); sets the response code
implicitly to 302 (unless it has already been set to 201 or 3xx) [1].
By settings the status code/header first, header('Location: ..') will
not change the status code, if the PSR-7 response object contains a
proper redirect status code.

[1] http://php.net/manual/en/function.header.php
    The second special case is the "Location:" header.
    Not only does it send this header back to the browser, but it also
    returns a REDIRECT (302) status code to the browser unless the 201
    or a 3xx status code has already been set.

Review

  • Code review CR +2
    • Morton Jonuschat +2
    • Josef Glatz +1
  • Verified V +2
    • Morton Jonuschat +2
    • Josef Glatz +1
    • TYPO3com +1 CI

Files 1

Review log 45

  1. Susi Moog commented on patch set 1 02/24/17, 07:59

    Cherry Picked from branch master.
  2. TYPO3com voted on patch set 1 V +1 02/24/17, 08:05 Completed build in 05m 13s on Fri, 24 Feb, 09:05 AM Test Summary: 38575 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC76-746

  3. Josef Glatz voted on patch set 1 CR +1 V +1 02/24/17, 09:02

  4. Morton Jonuschat voted on patch set 1 CR +2 V +2 02/26/17, 16:50

  5. Gerrit merged patch set 1 02/26/17, 16:50