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

[PSR-7] Clarify superglobal usage #354

Merged
merged 2 commits into from
Oct 16, 2014

Conversation

weierophinney
Copy link
Contributor

Per this thread:

  • Updated getQueryParams() to indicate that the value MAY come from $_GET, but may come from other sources, but MUST follow the same structure as $_GET.
  • Updated (get|set)CookieParams() to indicate that the value MAY come from $_COOKIE, but may come from other sources, but MUST follow the same structure as $_COOKIE.
  • Updated getFileParams() to indicate that the value MAY come from $_FILES, but may come from other sources, but MUST follow the same structure as $_FILES.

Per this thread:

  • Updated getQueryParams() to indicate that if the value injected is from the URI, the same rules that PHP's parse_str() would use should be followed when dealing with duplicate query parameters and nested values.

Per this thread:

  • Updated (get|set)BodyParams() to ONLY use arrays, not objects. This means that you can only inject deserialized body parameters IF they can be coerced to an array. Note: you can get creative with this, and do something like $request->setBodyParams([ 'payload' => $anObject ]);. The point is having a consistent mechanism.
  • Updated all methods in the IncomingRequestInterface to stipulate that arrays ONLY are accepted or returned; again, this is for consistency of implementation.
  • Renamed (get|set)PathParams() to (get|set)Attributes(), per a suggestion from @simensen; the docblock was updated to indicate "attributes derived from the request."

- Updated docblocks for query, cookie, and file parameters to indicate that the
  data sources MAY come from superglobals, or MAY come from other sources, but
  MUST mimic the structure for the corresponding superglobal.
- Clarified that when injecting query parameters manually from values parsed
  from the URI, the rules that PHP's parse_str() follows MUST be followed.
- Return values are stipulated to be arrays in all cases.
- Body parameters stipulate only arrays as well, not objects, for consistent
  runtime behavior between implementations.
- `s/PathParams/Attributes/`, per @simensen
philsturgeon added a commit that referenced this pull request Oct 16, 2014
@philsturgeon philsturgeon merged commit d901162 into php-fig:master Oct 16, 2014
@weierophinney weierophinney deleted the hotfix/superglobals branch October 16, 2014 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants