From:             michal at michal dot waw dot pl
Operating system: Linux
PHP version:      5.5.1
Package:          Filesystem function related
Bug Type:         Bug
Bug description:filesize() fails for files with high inode number

Description:
------------
I have a file for which filesize() can't return value. "stat" result for
this file:

Original file:
  File: 'DSC_5196_fx-1553725666.JPG'
  Size: 1907383         Blocks: 3728       IO Block: 4096   regular file
Device: 803h/2051d      Inode: 5905591363  Links: 1
Access: (0644/-rw-r--r--)  Uid: (   51/    http)   Gid: (   51/    http)
Access: 2013-08-13 00:47:28.107477918 +0200
Modify: 2013-08-12 21:38:27.219913208 +0200
Change: 2013-08-13 00:47:08.931478654 +0200
 Birth: -

I've made an exact copy, in same dir, same permissions:

Copy:
  File: 'DSC_5196_fx-1553725666_X.JPG'
  Size: 1907383         Blocks: 3728       IO Block: 4096   regular file
Device: 803h/2051d      Inode: 144         Links: 1
Access: (0644/-rw-r--r--)  Uid: (   51/    http)   Gid: (   51/    http)
Access: 2013-08-13 00:45:48.000000000 +0200
Modify: 2013-08-12 21:38:27.000000000 +0200
Change: 2013-08-13 00:47:28.199477914 +0200
 Birth: -

filesize() works for this new file.

I can't find any other difference between these two files.

I checked that filesize() works for files with inode number less or equal
to 4126207367and doesn't work for files with inode number equal or greater
than 4358705632. I didn't find files with inode number in between but I'm
still looking.

To me it seems that filesize() has problem with inode number higher than
2^32.

Test script:
---------------
<html>
<body>
<pre>
<?

$f1 =
'/home/services/httpd/html.galeria.michal.waw.pl/gallery/var/albums/988_Rok-2013/Sobota/DSC_5196_fx-1553725666.JPG';
$f2 =
'/home/services/httpd/html.galeria.michal.waw.pl/gallery/var/albums/988_Rok-2013/Sobota/DSC_5196_fx-1553725666_X.JPG';

print $f1.": ".filesize($f1)."\n";
print $f2.": ".filesize($f2)."\n";

?>
</pre>
</body>
</html>

Expected result:
----------------
I expected to see sizes of both files.

Actual result:
--------------
Warning: filesize(): stat failed for
/home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666.JPG
in /home/services/httpd/html.galeria.michal.waw.pl/gallery3-3.0.x/test.php
on line 13
/home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666.JPG:

/home/services/httpd/html.galeria.XXX/gallery/var/albums/988_Rok-2013/333_Rydzewo-04-06.08.2013/Sobota/DSC_5196_fx-1553725666_X.JPG:
1907383

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65445&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65445&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65445&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65445&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65445&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65445&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65445&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65445&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65445&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65445&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65445&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65445&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65445&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65445&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65445&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65445&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65445&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65445&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65445&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65445&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65445&r=mysqlcfg

Reply via email to