From:             kraghuba at in dot ibm dot com
Operating system: Linux and varient
PHP version:      5CVS-2007-09-12 (snap)
PHP Bug Type:     Filesystem function related
Bug description:  Inconsistent behavior file_exists() & is_file() functions 

Description:
------------
Inconsistent behaviour of file_exists() & is_file() functions when given
filename end with a trailing slash

The functions: file_exists(), is_file() return inconsistent value on
different OS when given
filename/path end with a trailing slash (/). On RHEL 5 and Windows XP that
i have, it retuns false, which is expected. 

There have been some fixes done relating to this to get the consistent
behavior( match Windows with 
Linux behavior on handling on trailing slash, Defect #42027) but I have
noticed that on different platform( linux and varient ) 
the output differ. 

I think, this is something to do with the way realpath work on different
OS.

Following are the testcases that continue to fail because of this on few
linux and other Os but not on all(I have been watching the PHP-QA list and
seen these failures): 

  1) is_file_variation4.phpt
  2) rename_variation.phpt



Reproduce code:
---------------
<?php
  fclose( fopen("test.tmp") );
  var_dump( is_file("test.tmp/") );
  var_dump( file_exists("test.tmp/") );
  unlink("test.tmp");
?>



Expected result:
----------------
bool(false)
bool(false)


Actual result:
--------------
Actual output ( on some of Linux and other OS, excluding Windows ):
-------------------------------------------------------------------
bool(true)
bool(true)

-- 
Edit bug report at http://bugs.php.net/?id=42638&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42638&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42638&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42638&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42638&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42638&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42638&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42638&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42638&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42638&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42638&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42638&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42638&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42638&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42638&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42638&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42638&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42638&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42638&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42638&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42638&r=mysqlcfg

Reply via email to