|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 17:01:23 2020 UTC