From:             mahesh dot vemula at in dot ibm dot com
Operating system: RHEL4
PHP version:      5CVS-2007-08-08 (snap)
PHP Bug Type:     Performance problem
Bug description:  filesize() on symlink returns size of the file pointed by it.

Description:
------------
When filesize() is applied on a symbolic link to a file, it returns the
size of the file pointed by it instead of returning the size of symlink
itself. This is happening for both php5 and php6. Is this the valid
behavior?

Reproduce code:
---------------
<?php
$file_handle = fopen("test.tmp", "w");
fwrite( $file_handle, str_repeat("Hello World, this is 2007 year ....\n",
100) );
fclose($file_handle);

symlink("test.tmp", "test_symlink.tmp");  //creating symlink

var_dump( filesize("test_symlink.tmp") );  //size of the symlink itself
clearstatcache();
var_dump( filesize("test.tmp") );  //size of the file
clearstatcache();

unlink("test_symlink.tmp");
unlink("test.tmp");
?>


Expected result:
----------------
-sizeof(symlink)-
int(3600)

Actual result:
--------------
int(3600)
int(3600)

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

Reply via email to