Feature #36217

As a developer I would like to have access to php://input in a uniform way

Added by Claus Witt over 9 years ago. Updated over 9 years ago.

Should have
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Has patch:


When using flow3 to create rest controllers, sometimes you would like to be able to have access to php://input from multiple sources (authentication token, controller and aspect/pointcut might all be relevant places). However if doing a PUT request and trying to read the php://input multiple times, it will return an empty string.

I guess the correct place to have this is in TYPO3\FLOW3\Utility\Environment - and either setting php:/input content to a instance variable in the constructor - or saving the value of the stream on the first read (to save the call to file_get_contents - or similar - to use cases where it is actually used).

I have attaached a quick diff to show what I mean.


access-to-raw-input.diff (1.04 KB) access-to-raw-input.diff Claus Witt, 2012-04-17 13:06
access-to-raw-input.diff (1.03 KB) access-to-raw-input.diff Claus Witt, 2012-04-17 13:08

Updated by Claus Witt over 9 years ago

The first diff had some copied comments from getRawPostArguments


Updated by Bastian Waidelich over 9 years ago

  • Category set to Environment

Hi Claus,

Good catch and I think we could implement it the way you suggested.
BTW: Why the "$\" in front of the file_get_content() call?
BTW┬▓: If you're trying to get REST support, you might be interested in the simple REST-Test package I wrote a while ago (It probably needs minor adjustments to the latest code base).


Updated by Robert Lemke over 9 years ago

  • Status changed from New to Resolved
  • Assignee set to Robert Lemke
  • Target version set to 1.1
  • PHP Version set to 5.3
  • Complexity changed from easy to medium

This is already implemented in FLOW3 1.1, see FLOW3\Http\Request for more details:

     * Returns the content of the request body
     * @param boolean $asResource If set, the content is returned as a resource pointing to PHP's input stream
     * @return string|resource
     * @api
    public function getContent($asResource = FALSE) {

Also available in: Atom PDF