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
Fixed UploadedFile::moveTo()
so it actually removes the original file when used in CLI context, and doesn't leave orphaned files
#98
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for me, but a test needs to be added here.
UploadedFile::moveTo()
so it actually removes the original file when used in CLI context, and doesn't leave orphaned files
Also to be asked here: do we merge to |
I'm not in a hurry, so it's OK to |
5c574d7
to
b785859
Compare
…t as is. Signed-off-by: katsuren <katsuren.houken@gmail.com>
Signed-off-by: katsuren <t@k2rn.com>
… types everywhere
b785859
to
091487a
Compare
@froschdesign |
I agree that this PR should be considered at the very least as a minor breaking change. It broke quite a few of my unit tests. At least it was easy to notice the breakage. But now I need to use what feels like a dirty workaround, something similar to: <?php
use Laminas\Diactoros\Stream;
use Laminas\Diactoros\UploadedFile;
- new UploadedFile('my-file-for-unit-test', 999, UPLOAD_ERR_OK),
+ new UploadedFile(new Stream('my-file-for-unit-test'), 999, UPLOAD_ERR_OK), |
Signed-off-by: katsuren katsuren.houken@gmail.com
UploadedFile::moveTo doesn't work in CLI. Original file leave it as is.
Description
Calling UploadedFile::moveTo in CLI, it just copies the file to the targetPath.
In addition to this, the stream grabs the original file, so it cannot delete the file, and I cannot access the stream so I couldn't release the file pointer.
In a test for uploading file, I want to remove the uploaded file to keep clean the test folder.