php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33100 file_exists() doesn't work correctly after realpath()
Submitted: 2005-05-22 14:04 UTC Modified: 2005-05-22 15:20 UTC
From: palacsint at freemail dot hu Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.3.10 OS: linux
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: palacsint at freemail dot hu
New email:
PHP Version: OS:

 

 [2005-05-22 14:04 UTC] palacsint at freemail dot hu
Description:
------------
If the upload_tmp_dir is a symlink, file_exists() doesn't work after a realpath() call. In my server the default /tmp is a symlink to /home/tmp. It works if i change the upload_tmp_dir to the /home/tmp. (safe_mode on)

Reproduce code:
---------------
    $t = $_FILES["uf"]["tmp_name"];
// $t = /tmp/phpAbcde
// realpath($t) = /home/tmp/phpAbcde
    var_dump(file_exists($t)); // true
    var_dump(file_exists(realpath($t))); // false
    var_dump(is_file($t)); // true
    var_dump(is_file(realpath($t))); // false


Expected result:
----------------
I got false when i called the file_exists() and is_file() with realpath($t).


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-22 14:14 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

And please provide a short but complete reproduce script. The code you provided will cause parse errors.
 [2005-05-22 15:10 UTC] palacsint at freemail dot hu
I tried the CVS snapshot. Its work correctly. Thanks!
 [2005-05-22 15:20 UTC] tony2001@php.net
Works fine -> closed.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Sep 20 08:00:02 2025 UTC