php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29952 tempnam() always returns system temp directory
Submitted: 2004-09-02 15:10 UTC Modified: 2004-09-02 15:43 UTC
From: patripaq at hotmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.7 OS: Windows 2000 Server
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: patripaq at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-09-02 15:10 UTC] patripaq at hotmail dot com
Description:
------------
When I call the tempnam() function, it always returns a file located in the system temp directory (C:\WINNT\TEMP) even if I specify an existing directory.

Reproduce code:
---------------
class TxtFile
{
  var $_tmp_dir = '/web/tmp/';

  function gentmp() {
    $tmp = '';
    if( is_dir( $this->_tmp_dir ) )
      $tmp = tempnam( $this->_tmp_dir, get_class($this) );
      // $tmp is always located in 'C:\WINNT\TEMP\' even
      // if specified directory exists...
    return $tmp;
  }
}

$txt = new TxtFile();
echo $txt->gentmp();

Expected result:
----------------
/web/tmp/txt9375.tmp

Actual result:
--------------
C:\WINNT\TEMP\txt9375.tmp

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-02 15:43 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

/tmp/web exists on windows? 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 09:01:38 2025 UTC