php.net |  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
Votes:12
Avg. Score:4.1 ± 0.9
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: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: flconseil at yahoo dot fr
New email:
PHP Version: OS:

 

 [2006-07-06 16:59 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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 
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.
 [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] jani@php.net
-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).

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.
 [2014-04-01 21:19 UTC] neufeind@php.net
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!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC