|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-26 00:55 UTC] adam-phpbugs at adam dot gs
Description:
------------
on a filesystem with a negative amount of free space (this
can happen on at least FreeBSD) disk_free_space returns
unreasonable results.
-=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=-
[root@cube]# php -r 'print disk_free_space(".")."\n";'
3.77789318629E+22
-=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=-
[root@cube]# df -h .
Filesystem Size Used Avail Capacity Mounted on
/dev/ad7 289G 289G -23G 109% /some/path
-=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=-
[root@cube]# df .
Filesystem 1K-blocks Used Avail Capacity Mounted
on
/dev/ad7 302732078 302699550 -24186038 109% /some/
path
Reproduce code:
---------------
php -r 'print disk_free_space(".")."\n";'
Expected result:
----------------
-24186038
Actual result:
--------------
3.77789318629E+22
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 23:00:01 2025 UTC |
For some reason I didn't get any notification of stas's message. this is FreeBSD 6.2-STABLE <pre> struct statvfs { fsblkcnt_t f_bavail; /* Number of blocks */ fsblkcnt_t f_bfree; fsblkcnt_t f_blocks; fsfilcnt_t f_favail; /* Number of files (e.g., inodes) */ fsfilcnt_t f_ffree; fsfilcnt_t f_files; unsigned long f_bsize; /* Size of blocks counted above */ unsigned long f_flag; unsigned long f_frsize; /* Size of fragments */ unsigned long f_fsid; /* Not meaningful */ unsigned long f_namemax; /* Same as pathconf(_PC_NAME_MAX) */ };</pre> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/statvfs.h for cvs/changelog (make sure your looking at 6.2-RELEASE) branch, there may be differences.