Giter Club home page Giter Club logo

Comments (6)

Richard87 avatar Richard87 commented on May 24, 2024

Hi!

I get the exact same error too:

Warning: fclose(): supplied resource is not a valid stream resource

$logger->info("Uplaoding local file", ['size' => $this->size, 'filename' => $this->filename]);
$fileSize = filesize($this->localfile);
if (!$fileSize)
     throw new \DomainException("Couldn't read filesize! " . error_get_last());

$this->size = $fileSize;
$fh = fopen($this->localfile, "rb");
if (!is_resource($fh))
    throw new \DomainException("Couldn't open file! " . error_get_last());

$success = $filesystem->writeStream($this->getRealPath(), $fh);
fclose($fh);

from flysystem-google-cloud-storage.

Richard87 avatar Richard87 commented on May 24, 2024

It might be tricky to solve, Guzzle6's Stream wrapper closes the stream on __destruct,

This creates a few issues when using Flysystems ReplicateAdapter when the Stream is closed prematurely :/

https://github.com/thephpleague/flysystem-replicate-adapter

from flysystem-google-cloud-storage.

TerraSkye avatar TerraSkye commented on May 24, 2024

doesn't this issue resides with the twistor/flysystem-stream-wrapper package ?

from flysystem-google-cloud-storage.

Richard87 avatar Richard87 commented on May 24, 2024

Hi!

It's been a while since I looked at it, but I think this is the relevant file https://github.com/guzzle/psr7/blob/master/src/Stream.php#L78:

/**
 * Closes the stream when the destructed
 */
public function __destruct()
{
    $this->close();
}

from flysystem-google-cloud-storage.

bradjones1 avatar bradjones1 commented on May 24, 2024

Refs: twistor/flysystem-stream-wrapper#9

from flysystem-google-cloud-storage.

nicja avatar nicja commented on May 24, 2024

Closed as this issue is not related to this package

from flysystem-google-cloud-storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.