Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] Making stream functions accept Splfileobject instances

Posted by nyamsprod the funky webmaster 
nyamsprod the funky webmaster
[PHP-DEV] Making stream functions accept Splfileobject instances
September 30, 2017 11:40AM
Hi internals,

I've been following the resolution of this bug:

https://bugs.php.net/bug.php?id=44392

and it seems that there is no safe way to expose the internal
`SplFileObject` filepointer.

So I was wondering if we could not do things differently and instead of
trying to expose the internal file pointer make any `stream_*` function
which accept a resource stream as parameter accept a `SplFileObject`. By
doing so we could resolve a couple of issues I encountered while using this
SPL object without adding any new method to the class we could:

- get informations about the object seekable and open mode status using
`stream_get_meta_data`.
- append/prepend stream filters without using the `php://filter/` hack
which has its own limitations.

What do you think ?
Sorry, only registered users may post in this forum.

Click here to login