#42248 [Opn->Bgs]: filesize() on symlink returns size of the file pointed by it.
| From: | iliaa@php.net | Date: | Thu, 09 Aug 2007 23:28:00 +0000 |
| Subject: | #42248 [Opn->Bgs]: filesize() on symlink returns size of the file pointed by it. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115924@lists.php.net to get a copy of this message | ||
ID: 42248
Updated by: iliaa@php.net
Reported By: mahesh dot vemula at in dot ibm dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: RHEL4
PHP Version: 5CVS-2007-08-08 (snap)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2007-08-08 13:11:03] mahesh dot vemula at in dot ibm dot com
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 this bug report at http://bugs.php.net/?id=42248&edit=1