You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically by design: not intentional, but due to the limitations of user defined stream wrappers in PHP and the knowledge of the author when vfsStream was initially created*. You can only have one root dir at a time. The second call to vfsStream::setup() destroys the first representation of the file system, so reusing anything of that first one after that leads to undefined behavior. I'm not exactly sure, but I think the second call to mkdir() creates the new dir as a child of the "other" directory. In the second file_put_contents() call you are trying to put the file into vfs://root/test/code-65b3c45ed2883/42/ff/91/Fails.txt, but this directory doesn't exist then, as it would belong to the first file system which was abandoned, therefore the call fails.
*With the knowledge of today it could be changed in vfsStream, but not without a massive bc break.
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:
Thank you for this great project.
The text was updated successfully, but these errors were encountered: