php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #37555 chdir() does not use file protocol stream wrappers
Submitted: 2006-05-23 01:36 UTC Modified: 2021-08-26 12:14 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: jb at jbpros dot com Assigned: cmb (profile)
Status: Wont fix Package: Directory function related
PHP Version: 5.1.4 OS: GNU/Linux Gentoo
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: jb at jbpros dot com
New email:
PHP Version: OS:

 

 [2006-05-23 01:36 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 23:43 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Directory function related
 [2021-08-26 12:14 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-08-26 12:14 UTC] cmb@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC