|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31127 The "." in open_basedir is always getting translated to SG(path_translated) dir
Submitted: 2004-12-16 16:59 UTC Modified: 2005-01-31 23:18 UTC
From: kameshj at fastmail dot fm Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 5.0.3 OS: Any Operating System
Private report: No CVE-ID: None
 [2004-12-16 16:59 UTC] kameshj at fastmail dot fm
The "." in open_basedir is always getting translated to directory portion of SG(path_translated).

This behaviour is fine for a CGI or mod_php5 module. But not for a CLI where "." != the directory of the script 

Reproduce code:
1)Keep a script in /home/kameshj/scripts/test.php
2)Keep a file k.txt with some content in /home/kameshj
3)Keep open_basedir as "."
echo getcwd();
echo "\n";

Run the above php from the working directory /home/kameshj

php /home/kameshj/scripts/test.php

Even though we have "."(/home/kameshj in this case) as open_basedir and we access /home/kameshj/k.txt file_access will still fail as "." is taken as /home/kameshj/scripts

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-16 17:55 UTC]
No bug here, unless all other SAPI's the CLI will not chdir to the scripts directory so the CWD is different now.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jul 05 08:01:27 2020 UTC