Closed Zegnat closed 6 years ago
:+1:
I understood that the implementation of StreamFactoryInterface::createStreamFromFile
should handle errors correctly.
I am using nyholm/psr7 as psr-17 implementation so #20 issue will solve by this PR and latest of nyholm/psr7.
Excellent. Thank you for reporting this. And thank you @Zegnat for finding the issue and providing a fix.
It is possible for
StreamFactoryInterface::createStreamFromFile
to fail and throw aRuntimeException
. One such case may occur when the file upload has failed and thetmp_name
is empty.ServerRequestCreator
should not exit on such an error, and should be able to create a list ofUploadedFile
instances included those with errors. WhenStreamFactoryInterface::createStreamFromFile
fails, use an emptyStream
instead.This hopefully fixes #20. At least as far as this package is concerned.
Would love it if you could especially review the unit test, @Nyholm. This was a bit of a head scratcher. I’m using a mock
StreamFactoryInterface
so I can makecreateStreamFromFile
always throw…