|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38025 Missing stream wrapper methods
Submitted: 2006-07-06 16:59 UTC Modified: 2011-02-21 21:32 UTC
Avg. Score:4.2 ± 0.8
Reproduced:10 of 10 (100.0%)
Same Version:6 (60.0%)
Same OS:8 (80.0%)
From: flconseil at yahoo dot fr Assigned:
Status: Open Package: Streams related
PHP Version: 5.3 OS: *
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-07-06 16:59 UTC] flconseil at yahoo dot fr
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-25 18:36 UTC] james at gogo dot co dot nz
In the 4 years since this bug/feature request was reported, flock() has been 

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.
 [2010-06-26 06:26 UTC] 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()).
 [2011-02-21 21:32 UTC]
-Package: Feature/Change Request +Package: Streams related -Operating System: All +Operating System: * -PHP Version: 5.1.4 +PHP Version: 5.3
 [2012-02-20 19:37 UTC] mirco dot babin at gmail dot com
I implemented my own stream, named "localexe" on the Windows platform 
(using C, not php user streams).

The realpath('localexe://localhost/teststream.php'); should return 
"localexe://localhost/teststream.php", because it exists. 
Currently it returns false.

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"

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
I think this is the main problem.
 [2014-04-01 21:19 UTC]
Since 5.4 there is a stream_metadata:
which offers support for:
* touch()
* chmod()
* chown()
* chgrp()

I can confirm that for example symlink() is unfortunately still missing!
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Fri Oct 09 08:01:37 2015 UTC