-
-
Notifications
You must be signed in to change notification settings - Fork 453
TypeError when event is captured on a request with file uploads #1517
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
Comments
Looking at your stack trace, the issue seems to stem from https://github.com/php-http/discovery. |
yes, seems to have started happening with the upgrade of that dependency and the change from |
Mind opening an issue over there so they can take a look? |
A new version of php-http/discovery was released and should fix this issue. |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
3.17.0
Steps to Reproduce
Sentry SDK is throwing a TypeError when I capture an event during a request that has file uploads.
In my case, the $filename passed to Http\Discovery\Psr17Factory::createStreamFromFile() is an array such as
[0 => '/tmp/phpPzNFTx']
rather than a string.The file upload field is using nested array syntax for doing multiple file uploads, e.g.
<input multiple="multiple" type="file" name="files[upload_0][]">
Expected Result
Event is captured by Sentry.
Actual Result
TypeError: Http\Discovery\Psr17Factory::createStreamFromFile(): Argument #1 ($filename) must be of type string, array given, called in /vendor/php-http/discovery/src/Psr17Factory.php on line 271 in Http\Discovery\Psr17Factory->createStreamFromFile() (line 120 of /vendor/php-http/discovery/src/Psr17Factory.php)
#0 /vendor/php-http/discovery/src/Psr17Factory.php(271): Http\Discovery\Psr17Factory->createStreamFromFile(Array, '...')
#1 /vendor/php-http/discovery/src/Psr17Factory.php(184): Http\Discovery\Psr17Factory->normalizeFiles(Array)
#2 /vendor/php-http/discovery/src/Psr17Factory.php(106): Http\Discovery\Psr17Factory->buildServerRequestFromGlobals(Object(GuzzleHttp\Psr7\ServerRequest), Array, Array)
#3 /vendor/sentry/sentry/src/Integration/RequestFetcher.php(25): Http\Discovery\Psr17Factory->createServerRequestFromGlobals()
#4 /vendor/sentry/sentry/src/Integration/RequestIntegration.php(125): Sentry\Integration\RequestFetcher->fetchRequest()
#5 /vendor/sentry/sentry/src/Integration/RequestIntegration.php(117): Sentry\Integration\RequestIntegration->processEvent(Object(Sentry\Event), Object(Sentry\Options))
#6 /vendor/sentry/sentry/src/State/Scope.php(378): Sentry\Integration\RequestIntegration->Sentry\Integration{closure}(Object(Sentry\Event), Object(Sentry\EventHint))
#7 /vendor/sentry/sentry/src/Client.php(292): Sentry\State\Scope->applyToEvent(Object(Sentry\Event), Object(Sentry\EventHint))
#8 /vendor/sentry/sentry/src/Client.php(169): Sentry\Client->prepareEvent(Object(Sentry\Event), Object(Sentry\EventHint), Object(Sentry\State\Scope))
#9 /vendor/sentry/sentry/src/State/Hub.php(152): Sentry\Client->captureEvent(Object(Sentry\Event), Object(Sentry\EventHint), Object(Sentry\State\Scope))
#10 /vendor/sentry/sentry/src/functions.php(55): Sentry\State\Hub->captureEvent(Object(Sentry\Event), Object(Sentry\EventHint))
The text was updated successfully, but these errors were encountered: