php.net |  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
Description:
------------
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 "."
///home/kameshj/scripts/test.php
<?php
echo getcwd();
echo "\n";
var_dump(file_exists("/home/kameshj/k.txt"));
?>

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:
----------------
/home/kameshj
bool(true)

Actual result:
--------------
/home/kameshj
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-16 17:55 UTC] derick@php.net
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-2019 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 08:01:25 2019 UTC