Req #37555 [Opn->Wfx]: chdir() does not use file protocol stream wrappers
| From: | cmb@php.net | Date: | Thu, 26 Aug 2021 12:14:12 +0000 |
| Subject: | Req #37555 [Opn->Wfx]: chdir() does not use file protocol stream wrappers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236081@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=37555&edit=1
ID: 37555
Updated by: cmb@php.net
Reported by: jb at jbpros dot com
Summary: chdir() does not use file protocol stream wrappers
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Directory function related
Operating System: GNU/Linux Gentoo
PHP Version: 5.1.4
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
You're right that chdir() doesn't accept any stream wrappers; this
is likely due to the virtual CWD which is mandatory for
thread-safe engine builds. While I think it would be *possible*
to change that, I have doubts that it would be useful enough to
justify the complexity, and given that there were no further
comments or upvotes for more than 15 years, I'm closing as
WONTFIX.
Previous Comments:
------------------------------------------------------------------------
[2006-05-23 01:36:49] jb at jbpros dot com
Description:
------------
chdir() seems to not use streams to validate the passed path. When one defines a custom wrapper for
the file:// scheme, it can be problematic.
For example, my custom file:// wrapper is acting like a root jail, "/" being mapped to
some directory on disk. This was needed to prevent XML documents xinclude()'ing stuffs outside
of the authorized directory, among other things. It works very well except that I'm forced to
set the CWD to "/" as other jailed directories are reported as "not found" by
PHP.
Example:
If "/srv/www/jail" is the root jail "/srv/www/jail/data/file.xml" is accessible
within the script under the path "/data/file.xml". There I have no way to set the CWD to
/data if the real on-disk "/data" path doesn't exist.
Maybe this behavior should not change for some reason, but this is a use case where it would be
nice.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=37555&edit=1