0

I'm using a package which creates SplFileInfo objects and then calls getRealPath() on them.

I want to work with strings instead of files, so I'm trying to register a stream wrapper like this:

stream_wrapper_register("mywrapper", \MyFileStream::class);

so that then I can call the package with a filename like mywrapper://file.txt, and have MyFileStream return the string when the file is read.

However, the package is calling SplFileInfo::getRealPath() and getting FALSE back and then crashing.

Looking at https://www.php.net/manual/en/class.streamwrapper.php, I don't see how I can affect that. Is there a way?

4

0 に答える 0