php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53796 Allow setting to home directory "~" on Linux with open_basedir
Submitted: 2011-01-20 02:15 UTC Modified: 2011-01-20 07:13 UTC
From: markh789 at gmail dot com Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 5.3.5 OS: Linux/Unix
Private report: No CVE-ID: None
 [2011-01-20 02:15 UTC] markh789 at gmail dot com
Description:
------------
This would be great if you could set it to the home directory, for example.

open_basedir="~:/tmp:/pearpath"

And then ~ would end up being the users home directory (that is running the 
script).

So if the user was smith, it would be like:

open_basedir="/home/smith:/tmp:/pearpath"

But only for that script. 

Test script:
---------------
<?php
# Running as smith
# open_basedir="~:/tmp:/pearpath"
# All "public" directory's are CHMOD to 777

// Test 1
touch("/tmp/test"); // pass

// Test 2
touch("/home/smith/public/test"); // pass

// Test 3
touch("/home/john/public/test"); // fail

?>

Expected result:
----------------
Test 3 should fail.

Actual result:
--------------
Test 3 passes. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-20 02:16 UTC] markh789 at gmail dot com
-Summary: Allow setting to home directory "~" on Linux +Summary: Allow setting to home directory "~" on Linux with open_basedir
 [2011-01-20 02:16 UTC] markh789 at gmail dot com
Bad title, fixing.
 [2011-01-20 02:21 UTC] markh789 at gmail dot com
-Package: Security related +Package: Safe Mode/open_basedir
 [2011-01-20 02:21 UTC] markh789 at gmail dot com
Fixing Package
 [2011-01-20 07:13 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2011-01-20 07:13 UTC] pajoye@php.net
~ is a  shell hack and has nothing to do with the OS paths.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 21:01:29 2024 UTC