Req #38025 [Com]: Missing stream wrapper methods
| From: | neufeind@php.net | Date: | Tue, 01 Apr 2014 21:19:42 +0000 |
| Subject: | Req #38025 [Com]: Missing stream wrapper methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185023@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=38025&edit=1
ID: 38025
Comment by: neufeind@php.net
Reported by: flconseil at yahoo dot fr
Summary: Missing stream wrapper methods
Status: Open
Type: Feature/Change Request
Package: Streams related
Operating System: *
PHP Version: 5.3
Block user comment: N
Private report: N
New Comment:
Since 5.4 there is a stream_metadata:
http://www.php.net/manual/en/streamwrapper.stream-metadata.php
which offers support for:
* touch()
* chmod()
* chown()
* chgrp()
I can confirm that for example symlink() is unfortunately still missing!
Previous Comments:
------------------------------------------------------------------------
[2012-02-20 19:37:31] mirco dot babin at gmail dot com
I implemented my own stream, named "localexe" on the Windows platform
(using C, not php user streams).
1)
The realpath('localexe://localhost/teststream.php'); should return
"localexe://localhost/teststream.php", because it exists.
Currently it returns false.
2)
The chdir('localexe://localhost/'); results in "Warning: chdir()
[function.chdir]: No such file or directory (errno 2) in
localexe://localhost/teststream.php on line 383"
3)
Because chdir(); does not work with streams, the include('./testinclude1.php');
also doesn't work.
----
I tracked down in the sources to tsrm_virtual_cwd.h.
This is a layer on Windows to implement GetCurrentDirectory() avoiding
thread issues.
This layer can't handle any custom stream, it always uses the local
filesystem.
I think this is the main problem.
------------------------------------------------------------------------
[2010-06-26 06:26:07] james at gogo dot co dot nz
I will add also that if touch() gets called with a (normally stream wrapped) URL,
it actually attempts to touch a file by that name on the local file system, most
likely unsuccessfully (producing a WARNING) but there is no particular reason why
it could not be successful in some situation.
Better/safer behavior would be to give an ERROR that you are trying to touch a
stream wrapped file which can't be touched (or preferably of course, implement
the ability for stream wrappers to accommodate touch()).
------------------------------------------------------------------------
[2010-06-25 18:36:28] james at gogo dot co dot nz
In the 4 years since this bug/feature request was reported, flock() has been
implemented.
I can not see any documentation to indicate that touch(), chmod() etc... are
possible to implement with stream wrappers yet.
url_stat() is able to provide read access for these data points, but there is no
means to provide the write access.
------------------------------------------------------------------------
[2006-07-06 16:59:40] flconseil at yahoo dot fr
Description:
------------
The following functions cannot be implemented in a stream wrapper because the corresponding methods
don't exist :
- chgrp & lchgrp
- chown &lchown
- chmod
- flock
- link & symlink/readlink
- touch
To be confirmed for :
- ftruncate
- realpath
For most of these (links, owner, mode), as the values can be returned by stat/lstat() calls, PHP
should provide a way to set/modify them.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=38025&edit=1