Edit report at https://bugs.php.net/bug.php?id=44392&edit=1
ID: 44392
Comment by: mattsch at gmail dot com
Reported by: php at benjaminschulz dot com
Summary: getFilePointer() for Childs of SplFileObject
Status: Open
Type: Feature/Change Request
Package: SPL related
PHP Version: 5.3CVS-2008-03-10 (CVS)
Block user comment: N
Private report: N
New Comment:
The Streamable interface sounds like a great idea. Now is this bug ever going to get prioritized?
Previous Comments:
------------------------------------------------------------------------
[2014-05-13 14:50:45] nyamsprod at gmail dot com
Even thought making the SplFileObject::getFilePointer() method public would be a great addition I
think there is a better solution which would be to create a abstract interface "Ã la"
Traversable but called "Streamable".
This interface would not be implemented alone but classes that implement it like SplFileObject would
be usable directly on function like stream_append_filter, streamp_get_metadata of even curl_setopt.
That way the SplFileObject file pointer would be "usable" but its file pointer property
would remain protected from a developer who would otherwise use the SplFileObject::getFilePointer()
result direclty on a fclose function.
------------------------------------------------------------------------
[2013-12-04 13:05:20] drgomesp at gmail dot com
Any updates on this? It would be really useful to change the visibility of this method to public.
------------------------------------------------------------------------
[2012-12-12 16:12:02] mattsch at gmail dot com
I agree that this method should also be public. Please implement this method ASAP.
------------------------------------------------------------------------
[2012-12-09 01:26:59] levim@php.net
I don't see why this method shouldn't be public. I vote for extending its
visibility to public.
------------------------------------------------------------------------
[2012-11-20 23:38:18] mattsch at gmail dot com
What's the status of this bug? SplFileObject is supposed to be an OO version of fopen but
it's quite useless to pass into other functions like curl when those functions expect a
resource.
Example:
$splFileObject = new SplFileObject('/tmp/foo', 'r');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'sftp://server.com/folder/');
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $splFileObject); # <-- won't work, must be file resource
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
curl_exec ($ch);
curl_close($ch);
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=44392
--
Edit this bug report at https://bugs.php.net/bug.php?id=44392&edit=1