{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/flysystem-gridfs/issues/9","repository_url":"https://api.github.com/repos/thephpleague/flysystem-gridfs","labels_url":"https://api.github.com/repos/thephpleague/flysystem-gridfs/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/flysystem-gridfs/issues/9/comments","events_url":"https://api.github.com/repos/thephpleague/flysystem-gridfs/issues/9/events","html_url":"https://github.com/thephpleague/flysystem-gridfs/issues/9","id":153778724,"number":9,"title":"writeStream causes segmentation fault","user":{"login":"seggen-ibuildings","id":4232642,"avatar_url":"https://avatars.githubusercontent.com/u/4232642?v=3","gravatar_id":"","url":"https://api.github.com/users/seggen-ibuildings","html_url":"https://github.com/seggen-ibuildings","followers_url":"https://api.github.com/users/seggen-ibuildings/followers","following_url":"https://api.github.com/users/seggen-ibuildings/following{/other_user}","gists_url":"https://api.github.com/users/seggen-ibuildings/gists{/gist_id}","starred_url":"https://api.github.com/users/seggen-ibuildings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seggen-ibuildings/subscriptions","organizations_url":"https://api.github.com/users/seggen-ibuildings/orgs","repos_url":"https://api.github.com/users/seggen-ibuildings/repos","events_url":"https://api.github.com/users/seggen-ibuildings/events{/privacy}","received_events_url":"https://api.github.com/users/seggen-ibuildings/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-09T13:41:09Z","updated_at":"2016-05-09T14:27:26Z","closed_at":"2016-05-09T14:27:26Z","body":"Hi, I'm not sure if I got it right, but it seems that calling `GridFSAdapter::writeStream()` causes a segmentation fault. I did some digging, and I saw that you call `MongoGridFs::storeFile()` with a resource as the first parameter. The MongoGridFs documentation suggests that this parameter should be a file name, not a file handle: http://php.net/manual/en/class.mongogridfs.php\r\n\r\nI think there are three options:\r\n- put the contents of the stream in memory and call `MongoGridFs::storeBytes()`\r\n- put the contents of the stream in a temporary file and pass the filename\r\n- I was wrong and this is a bug somewhere else\r\n"},"comment":{"url":"https://api.github.com/repos/thephpleague/flysystem-gridfs/issues/comments/217879818","html_url":"https://github.com/thephpleague/flysystem-gridfs/issues/9#issuecomment-217879818","issue_url":"https://api.github.com/repos/thephpleague/flysystem-gridfs/issues/9","id":217879818,"user":{"login":"seggen-ibuildings","id":4232642,"avatar_url":"https://avatars.githubusercontent.com/u/4232642?v=3","gravatar_id":"","url":"https://api.github.com/users/seggen-ibuildings","html_url":"https://github.com/seggen-ibuildings","followers_url":"https://api.github.com/users/seggen-ibuildings/followers","following_url":"https://api.github.com/users/seggen-ibuildings/following{/other_user}","gists_url":"https://api.github.com/users/seggen-ibuildings/gists{/gist_id}","starred_url":"https://api.github.com/users/seggen-ibuildings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seggen-ibuildings/subscriptions","organizations_url":"https://api.github.com/users/seggen-ibuildings/orgs","repos_url":"https://api.github.com/users/seggen-ibuildings/repos","events_url":"https://api.github.com/users/seggen-ibuildings/events{/privacy}","received_events_url":"https://api.github.com/users/seggen-ibuildings/received_events","type":"User","site_admin":false},"created_at":"2016-05-09T14:27:26Z","updated_at":"2016-05-09T14:27:26Z","body":"UPDATE: `MongoGridFs::storeFile()` seems to work for file descriptors (e.g. `fopen($filename, 'r+')`) but not streams (e.g. `fopen('php://memory', 'r+')`)\r\n\r\nalso, if I read the documentation just a bit better, I see that any readable stream should be accepted"}}