> Am 16.01.2023 um 16:01 schrieb G. P. B. <george.bany...@gmail.com>:
> 
> Hello internals,
> 
> I would like to start the discussion about the "Add file_descriptor()
> function" RFC:
> https://wiki.php.net/rfc/file-descriptor-function
> 
> This RFC proposes the addition of the file_descriptor() function to
> retrieve the underlying file descriptor of stream if it exists. This is
> useful when interacting with a USB device.
> 
> Best regards,
> 
> George P. Banyard

Hey George,

I like the idea. However two questions:

Why is it its own function and not part of stream_get_meta_data()? (which you 
anyway want to check to ensure that it's the proper stream type)
Why are all resources throwing a TypeError and not only resources which aren't 
streams? I could imagine calling that function to check whether the stream is 
in memory or backed by a fd for example. I'd propose to return a proper 
checkable value like -1 in that case.

Thanks,
Bob

Reply via email to