I have set up a vfsstream block device and I'm trying to call file_get_contents() on it.
However the call to vfsStreamWrapper::stream_open fails and therefore the stream cannot be opened.
Here is my code:
$this->root = vfsStream::setup('root');
$this->root->addChild(new vfsStreamBlock('test_block_device'));
$this->root->addChild(new vfsStreamFile('not_block_device'));
echo file_get_contents('vfs://root/test_block_device/size');
Here is the error:
file_get_contents(vfs://root/test_block_device/size): failed to open stream: "org\bovigo\vfs\vfsStreamWrapper::stream_open" call failed
Here is the closest issue I've found on this
However his was an issue with phpunit's teardown and mine happens mid-test.
From the docs it seems that you need to add some content to your block device before you read from it: https://github.com/mikey179/vfsStream/wiki/BlockDevices
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With