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
PHP Warning: fclose(): supplied resource is not a valid stream resource #311
Comments
Can you share a PHP script that reproduces this warning? Based on the code, it's not clear to me how this warning would be triggered unless |
I have inserted my example php code. You need some image files into mongo database "myfiles". I think, Close(); was invoked multiple times (for each image). |
I was able to test this a bit and it appears to be specific to PHP 7.x. Our StreamWrapper's
This makes sense, as our stream goes out of scope when I'm currently in the midst of refactoring the StreamWrappers to not use streams for buffer (see: #304), so this will be resolved. In the meantime, feel free to use the above work-around. |
Many thanks for your help. I've looked your refactoring and your benchmarks. It is surprising that a string buffer is faster than writing it directly into RAM. |
Strings are in RAM as well. I was a bit surprised to find that the |
This should be fixed by #304 and will be resolved in the next 1.1.x release. |
Correction: #304 pertained only to WritableStream refactoring. This was actually resolved by ReadableStream refactoring in #323 (PHPLIB-247). |
PHP 7.0.8
mongo-php-library 1.1.0 (final)
PHP Warning: fclose(): supplied resource is not a valid stream resource in .../src/GridFS/ReadableStream.php on line 78
This is my php code. It reads images from a MongoDB collection and display each file.
My solution is, to hide the warning...
The text was updated successfully, but these errors were encountered: