php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54710 sys_get_temp_dir() does not respect upload_tmp_dir
Submitted: 2011-05-11 15:45 UTC Modified: 2011-06-04 00:15 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: royanee at yahoo dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3.6 OS:
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: royanee at yahoo dot com
New email:
PHP Version: OS:

 

 [2011-05-11 15:45 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-11 15:47 UTC] 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-30 18:00 UTC] iliaa@php.net
-Status: Open +Status: Bogus
 [2011-05-30 18:00 UTC] 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-06-04 00:15 UTC] royanee at yahoo dot com
@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.
 [2013-03-14 10:32 UTC] mail+bugs dot php dot net at kazik dot de
This issue is handled in:
https://bugs.php.net/bug.php?id=60524

And it's available in php 5.5.0 Alpha 5 and up.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 03:01:28 2024 UTC