Skip to content

use Request and Response objects in entry points

Fridtjof requested to merge fridtjof-use-response into master

What does this MR do?

The entry points (index.php, xhr.php, xhrapp.php, api.php, restApi.php) are quite hard to understand, with many special cases for both new and legacy code with different behavior.

This merge request (as the first in many) tries to make the code easier to reason about by using Symfony's Request and Response classes to abstract away the raw header, echo and $_GET used in these files. I have taken great care to exactly replicate the previous code's behavior due to the important role these files play.

Tests don't seem to pass on my machine, but I'm not sure if that might be due to other issues. Once CI passes, I will remove the WIP prefix.

How confident are you it won't break things if deployed?

once tests pass, pretty confident

How to test

  • Use the website normally
  • trigger Xhr requests
  • try using the old api.php (for calendar generation?)
  • verify that different kinds of controllers work:
    • those that return the website content
    • those that modify a passed Response
    • those that return a Response
    • those that simply use 'echo' (directly or indirectly)

Checklist

  • no test necessary, this does not really affect specific features that could be tested
  • no unrelated changes
  • asked someone for a code review
  • joined #foodsharing-beta channel at https://slackin.yunity.org
  • added an entry to CHANGELOG.md (description, merge request link, username(s))
  • Once your MR has been merged, you are responsible to update the #foodsharing-beta Slack channel about what has been changed here. They will test your work in different browsers, roles or other settings
Edited by Chris Oelmueller

Merge request reports