php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24087 Make temporary_directory available in userland
Submitted: 2003-06-08 22:33 UTC Modified: 2010-12-21 19:26 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: philip at cornado dot com Assigned: johannes (profile)
Status: Closed Package: *General Issues
PHP Version: 5CVS-2003-06-08 (dev) OS: all
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: philip at cornado dot com
New email:
PHP Version: OS:

 

 [2003-06-08 22:33 UTC] philip at cornado dot com
How about making the result from get_temporary_directory() available in user land, most likely as a constant named TEMPORARY_DIRECTORY  This would be useful in that we'd know where this is, in both Windows and *nix.  The code that defines the internal variable temporary_directory is here:

http://lxr.php.net/source/php4/main/php_open_temporary_file.c#164

I'm not a devel guy, but the following hack seems mildly appropriate:

REGISTER_STRING_CONSTANT("TEMPORARY_DIRECTORY", get_temporary_directory(), strlen(get_temporary_directory()), 0);

Not sure where to put it though, or if it's fully correct (doubtful), but please consider this idea as it would be nice.

One *possible* concern is security but I think it's worth it, *maybe* disable this option in safe_mode.  It's not like the TEMP directory is a big secret, nor is viewing various related directives like session.save_path and upload_tmp_dir.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-09 02:49 UTC] derick@php.net
I don't really see the use of this. Why would this be useful?
 [2003-06-19 09:54 UTC] philip@php.net
My initial reason is upload_tmp_dir does not provide a value unless it's explicitly set, I need this information before sending a file (for a nice debugging tool that will help the masses).  On the contrary, session.tmp_path does provide its value regardless of it being explicitly set or not so that's a weird inconsistency among directive behavior.  Anyway, knowing TEMPORARY_DIRECTORY will solve my problem although 'fixing' upload_tmp_dir will also solve it. 

Either way, get_temporary_directory() will need to be called before a file is uploaded, I don't think it is currently.
 [2010-12-21 19:26 UTC] johannes@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: johannes
 [2010-12-21 19:26 UTC] johannes@php.net
sys_get_temp_dir() was introduced in 5.2.1
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Apr 28 11:01:30 2025 UTC