If the php://temp (or php://memory) file is opened more than once, will the handles point to the same file? Or will each handle be unique?
I couldn’t find an answer in the php docs, so I’m going to write up a test script to find out. I figured it’s worth asking here so someone else can find the answer easily.
Each handle points to an independent stream. Example:
This is not explicitly documented anywhere, but it is implicit in the documentation for streams and wrappers.
From the official php documentation on streams in general, it is clear that for the standard case of streams, each file handle is associated with it’s own independent stream.
And in the documentation on IO stream wrappers, it lists the possible wrappers noting exceptions as they occur. There is an exception listed for the first three (stdin, stdout, stderr):
But no such exception is listed for
php://temporphp://memory. Hence it follows that these would work like normal independent streams.Also, there are some comments on these pages that further imply the Independence of these streams.