Req #42929 [Com]: Cannot access the old stream wrapper from a wrapper class
| From: | neufeind@php.net | Date: | Fri, 11 Apr 2014 22:35:08 +0000 |
| Subject: | Req #42929 [Com]: Cannot access the old stream wrapper from a wrapper class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185185@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=42929&edit=1
ID: 42929
Comment by: neufeind@php.net
Reported by: woodsmailbox at yahoo dot com
Summary: Cannot access the old stream wrapper from a wrapper
class
Status: Open
Type: Feature/Change Request
Package: Streams related
Operating System: WinXP SP2
PHP Version: 5.2.4
Block user comment: N
Private report: N
New Comment:
Only way around this seems to be to inside your wrapper-function then to call
stream_wrapper_restore(), perform the work on your regular filesystem and before the end re-register
your stream-wrapper. While it's sort of a "hack" this way we successfully created a
wrapper that overlays certain directories/files but passes through all others to the real
file-layer.
Previous Comments:
------------------------------------------------------------------------
[2007-10-12 14:48:28] woodsmailbox at yahoo dot com
I also think getcwd() and chdir() should be open for stream-wrapping for the relative paths to work
with a wrapper for the default "file" scheme.
------------------------------------------------------------------------
[2007-10-11 14:52:42] woodsmailbox at yahoo dot com
... Another feature that could get me out of this chicken and egg problem would be to be able to
alias a built-in wrapper protocol in its current configuration (i.e. with it's current handler
class). I would happily alias "file:" to "filesystem:" and then register my own
wrapper class to the "file:" protocol and use the "filesystem:" protocol
internally.
------------------------------------------------------------------------
[2007-10-11 14:24:48] woodsmailbox at yahoo dot com
Description:
------------
I would like to "wrap" a stream wrapper, and this would include calling the original
wrapper's methods from my wrapper class. For instance, I would like to implement versioning
over the file:// protocol but I cannot access the filesystem while my file:// wrapper is registered.
It would be nice to be able to use the classes of built-in wrappers.
Also, I can't find the php function to change the default wrapper so I can have relative paths
handled by my wrapper. A lot of app. code not under my control use relative paths. I could register
my own file:// wrapper but then again...
My current workaround is to call stream_wrapper_restore() inside my wrapper's functions, do my
thing with the filesystem, then call stream_wrapper_register() again, but I think this sucks. I hope
php is doing no more than changing some pointers internally when I call these functions, otherwise,
the performance of my wrapper is gone.
Thanx.
Cosmin.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=42929&edit=1