Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-19058 (Discuss) Add Civi::request() facade based on Symfony HttpFoundation #8603

Closed
wants to merge 4 commits into from

Conversation

totten
Copy link
Member

@totten totten commented Jun 21, 2016

This provides a Symfony-style $request object, which includes
ParameterBags for various inputs (GET/POST/COOKIE) along with
various helpers for validation.

Note: I don't expect this to be a large patch, but it's one we may want
to think about carefully. A few issues/questions:

  • Symfony Standard Edition provides a request-stack service instead of
    a single request service. This is useful when processing nested
    requests. Should we be doing that?
  • Should we be thinking about the Response object at the same time?
  • In a D8 runtime, there's already a request object floating around.
    How should it relate?
  • How often does civicrm-core include overrides for fields in
    $_GET, $_REQUEST, $_POST? (My sense is not very often, with
    the exception of a special field like q.)

@eileenmcnaughton
Copy link
Contributor

One note - there is some funky handling in CRM_Utils_Request::getvalues for '&ampq' - which is 'q' mangled by payment processors & other external manglers. We do kinda need that since we can't control the url mangling they get up to

@totten
Copy link
Member Author

totten commented Jun 21, 2016

(Aside: There's also http://www.php-fig.org/psr/psr-7/ , but the part Eileen was looking for -- e.g. query->getInt('fooId') -- is specifically not part of PSR-7.)

@xurizaemon
Copy link
Member

xurizaemon commented Jun 21, 2016

I'd be interested to see where that funky &amp handling is really coming from / required ... According to CRM-18384 the origin of the problematic URLs was event dashboard + link shortening, in which case maybe we could have been best to address it there rather than in the request handler. (The ticket makes it sound like the order of query params was the issue, which makes the premise sound all the more suspect.)

Can we leave that special handling out to start with, or until we at least know what circumstances make it necessary?

@eileenmcnaughton
Copy link
Contributor

One example of $amp handling in PaymentExpress - it insists on url encoding any parameters in the array - so it will hit civicrm/payment/ipn/5 on wordpress as &ampq=civicrm/payment/ipn/5

@eileenmcnaughton eileenmcnaughton changed the title (Discuss) Add Civi::request() facade based on Symfony HttpFoundation CRM-19058 (Discuss) Add Civi::request() facade based on Symfony HttpFoundation Jul 11, 2016
@eileenmcnaughton
Copy link
Contributor

So, this is stale but that is easily fixed. I don't think it's good to keep pull requests open forever. There comes a point where they should be merged or closed with a link to the commit for future reference.

To articulate the issue we are trying to solve. We have the rather clunky CRM_Utils_System::retrieve() function with something more modern. This provides an option, although no examples on using it which would not encourage adoption.

My inclination is about 60% to close this & track on JIRA until interest arises again (possibly squashing into one commit so we can link to the commit which is more enduring than a closed PR)

@totten
Copy link
Member Author

totten commented Aug 25, 2017

I'm inclined to close the PR but keep the JIRA issue (categorized as "Improvement/Trivial") with a link to the PR.

Considerations:

  • In retrospect, I'm feeling that PSR-7 makes more sense for Civi than Symfony HTTP. The PSR spec ought to be more stable over time.
  • We need clearer problem statement/examples for the issues involving URL-encoding and payment-processors.
  • I have a gut-sense that 'request stacking' is actually a necessary concept.

@totten totten closed this Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants