php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45435 putenv("TMPDIR=... doens't always sets the TMPDIR
Submitted: 2008-07-04 21:00 UTC Modified: 2008-07-14 01:00 UTC
From: lvdgraaff at gmail dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.2.6 OS: Mac OS 10.5.3
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: lvdgraaff at gmail dot com
New email:
PHP Version: OS:

 

 [2008-07-04 21:00 UTC] lvdgraaff at gmail dot com
Description:
------------
Due to a bug with the ftp_*list functions I had to set the TMPDIR manually.
[http://bugs.php.net/bug.php?id=28865]

But, to my surprise, this doesn't ALWAYS work correctly. I'll demonstrate it with the function sys_get_temp_dir and tmpfile.

Details:
If the putenv fails, than it doesn't work to direct try it again. I really have to wait for a few seconds, before a retry will be succesfull. When it works again, it does it for a few minutes.

I use PHP 5.2.5, but I saw no issues in the changelog witch seem to be related to this.

Reproduce code:
---------------
<?
putenv("TMPDIR=/Users/lvdgraaff/Web/www/compile/tmp");

echo "GET ENV: \t" . getenv("TMPDIR") . "\n";
echo "SGTD: \t\t" . sys_get_temp_dir() . "\n";
print_r(tmpfile());

NOTE: this was the only code in the whole file

Expected result:
----------------
GET ENV: 	/Users/lvdgraaff/Web/www/compile/tmp
SGTD: 		/Users/lvdgraaff/Web/www/compile/tmp
Resource id #2

NOTE: I get this, most of the time, but not ALL the time.


Actual result:
--------------
GET ENV: 	/Users/lvdgraaff/Web/www/compile/tmp
SGTD: 		/var/folders/4T/4TDJmSQYGV04rPNp5PKZ2++++TI/-Tmp-/

(note: no resource, but an empty line!)

SOMETIMES I get this result.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-06 01:20 UTC] jani@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2008-07-14 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 20:01:34 2025 UTC