|  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: 2016-12-30 23:43 UTC
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:
Status: Open 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.
Block user comment
Status: Assign to:
Bug Type:
From: jb at jbpros dot com
New email:
PHP Version: OS:


 [2006-05-23 01:36 UTC] jb at jbpros dot com
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.


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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 23:43 UTC]
-Package: Feature/Change Request +Package: Directory function related
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Aug 03 02:01:24 2021 UTC