Bug #54710 [Bgs]: sys_get_temp_dir() does not respect upload_tmp_dir

From: Date: Fri, 03 Jun 2011 22:15:36 +0000
Subject: Bug #54710 [Bgs]: sys_get_temp_dir() does not respect upload_tmp_dir
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161175@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54710&edit=1

 ID:                 54710
 User updated by:    royanee at yahoo dot com
 Reported by:        royanee at yahoo dot com
 Summary:            sys_get_temp_dir() does not respect upload_tmp_dir
 Status:             Bogus
 Type:               Bug
 Package:            PHP options/info functions
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

@iliaa: Please tell me how to set the location of the temporary directory using php_admin_value or
php_value, as I do not see a way of setting the temporary directory at the vhost level in the
documentation. If that is not currently possible, please reclassify this as a valid feature request.
Thank you for your time.


Previous Comments:
------------------------------------------------------------------------
[2011-05-30 18:00:05] iliaa@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

The function is designed to return the location of the temporary directory, not 
the file upload directory.

------------------------------------------------------------------------
[2011-05-11 15:47:13] royanee at yahoo dot com

Additionally, enabling open_basedir results in FALSE and triggers the following warning:

PHP Warning:  tempnam(): open_basedir restriction in effect. File(/tmp) is not within the allowed
path(s): (/www/myvhost/)

------------------------------------------------------------------------
[2011-05-11 15:45:07] royanee at yahoo dot com

Description:
------------
The only configuration option for setting the temporary directory for normal operations is the
upload_tmp_dir option. As such, functions that rely on the temporary directory should respect the
upload_tmp_dir option to ensure that true separation of concerns between virtual hosts can be
achieved. This is particularly important when also using open_basedir.

Note that the following line is correctly located in the vhost config:

php_admin_value upload_tmp_dir "/www/myvhost/tmp"

Test script:
---------------
<?php
// Create a temporary file in the temporary 
// files directory using sys_get_temp_dir()
$temp_file = tempnam(sys_get_temp_dir(), 'Tux');

echo $temp_file;
?>

Expected result:
----------------
/www/myvhost/tmp/TuxDRhRIg

Actual result:
--------------
/tmp/TuxDRhRIg


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54710&edit=1


Thread (5 messages)

« previous php.bugs (#161175) next »