Skip to content

file_put_contents fails when vfsStream::setup() was invoked twice. #288

@yvoyer

Description

@yvoyer

I am using vfsStream to mock the file system as a service during the execution of a Symony app.

file_put_content() fails when creating another root dir was created.

Is there a way to have 2 root dirs, is it a bug or by design?

Steps to reproduce:

$root = vfsStream::setup('root');

mkdir($dir = $root->url() . '/test/code-65b3c45ed2883/64/1b/4e', 0777, true);
file_put_contents($dir . '/Works.txt', 'content');

$other = vfsStream::setup('other');

mkdir($dir = $root->url() . '/test/code-65b3c45ed2883/42/ff/91', 0777, true);

file_put_contents($dir . '/Fails.txt', 'content');
"PHP Warning:  file_put_contents(vfs://root/test/code-65b3c45ed2883/42/ff/91/Fails.txt): failed to open stream: "org\bovigo\vfs\vfsStreamWrapper::stream_open" call failed in ..."

Thank you for this great project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions