Zend\Http\PhpEnvironment\Request::getContent() sometimes return empty content #5102

Closed
svycka opened this Issue Sep 11, 2013 · 1 comment

Projects

None yet

2 participants

Contributor
svycka commented Sep 11, 2013

Request::getContent() uses file_get_contents('php://input') witch can be used once and if third party module called that first zend will fail.

php://input

Note: A stream opened with php://input can only be read once; the stream does not support seek operations. However, depending on the SAPI implementation, it may be possible to open another php://input stream and restart reading. This is only possible if the request body data has been saved. Typically, this is the case for POST requests, but not other request methods, such as PUT or PROPFIND.

maybe this isn't really a bug, but I had hard time figuring this out. I am wondering how symphony2 deals with this?

Member

Starting in PHP 5.6 php://input can now be read multiple times. Unfortunately, if you're on PHP 5.5 and 3rd-party code gets to php://input first you are SOL, there's nothing the framework can do to protect you against that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment