Open phuzzl opened 8 years ago
I encountered a similar issue with $stream = fopen('php://stdin', 'r')
, the problem came from the underlying lib phpseclib
I made a PR (see for explanations) which could hopefully solves your problem.
I'd like to add that this happens for remote files as well: $stream = fopen('http://path/to/file, 'rb')
I believe it has to do with with phpseclib/Net/SFTP's put
function trying to get the size of the remote file with fstat
but instead returning null
although I am not at all an expert on streams and not quite sure how to fix this.
Hi all!
Is there any progress in this issue? Unfortunately I am facing this issue as well. I can confirm it's really SFTP (or the underlying lib phpseclib) because the Local adapter and Dropbox adapter are working.
Also, I see the suggestion of the PR are commited to the code base, however the issue isn't solved...
I would like to hear from you!
Greetz,
Bob
For those who don't actually have to use writeStream()
, write()
works fine.
@wizonesolutions I just encountered this issue myself trying to download a huge file from a linux sftp box to a local linux filesystem. The transfer happened (the script execution was delayed during which stuff happened) but the resulting file had zero bytes. How does write work different? Does the file get buffered in php's memory? What happens if filesize exceeds lets say 10GB?
@radonthetyrant that's probably the main difference and the reason that won't work for everyone. From what I can tell, phpseclib did fix the issue. Maybe this project isn't using the new version? I didn't go that deep, as I didn't really want to patch.
When I try to write a stream via writeStream() it results in a zero byte file on the SFTP-Server.
With the Flysystem FTP adapter it works correctly.