Skip to content

Fix regression introduced in #1119 that prevents capturing of the request body - #1139

Merged
ste93cry merged 2 commits into
getsentry:masterfrom
ste93cry:fix/request-integration-does-not-capture-request-body
Nov 27, 2020
Merged

ste93cry merged 2 commits into
getsentry:masterfrom
ste93cry:fix/request-integration-does-not-capture-request-body

Conversation

@ste93cry

Copy link
Copy Markdown
Contributor

This PR fixes a regression introduced in #1119 and closes #1135: in particular, the php://input stream is not a file and fstat does not work on it and StreamInterface::getSize() always return 0. In reality, using the PSR-7 implementation from Guzzle that method does work as you read from the stream, but it does just because it remembers how many bytes it read until that point. Other SDKs implementations use the Content-Length header, I decided to do the same even though it may report incorrect data (which is unlikely anyway)

@ste93cry ste93cry added this to the 3.0 milestone Nov 20, 2020
@mfb

mfb commented Nov 21, 2020

Copy link
Copy Markdown
Contributor

it's possible for sentry to be installed w/ older versions of guzzlehttp/psr7 which have the now-deprecated copy_to_string() instead of Utils::copyToString() https://github.com/guzzle/psr7/blob/1.x/src/functions.php#L194

@ste93cry

Copy link
Copy Markdown
Contributor Author

Thanks for noticing it, I didn't see it because PHPUnit emitted a warning and the build was green!

@stayallive stayallive left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

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.

Sentry no longer capturing request body

4 participants