ID:               41493
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tayloj1 at uk dot ibm dot com
 Status:           Verified
 Bug Type:         Documentation problem
 Operating System: linux
 PHP Version:      Irrelevant
 New Comment:

I would raise a bug as 2 of the 3 os's which have different
implementations of this function support the supplying of a filename.
Only windows has (is?) the problem.

And it makes sense to ask how much space in on the drive holding a
file.


Previous Comments:
------------------------------------------------------------------------

[2007-05-29 11:09:10] tayloj1 at uk dot ibm dot com

OK, then please  - either  -  

(1) fix the function to make Linux implementation behave the same way
as Windows (eg. by adding a check to stop Linux users supplying a
filename). 

- or - 

(2) add the following text (instead of my previous suggestion): 

"Given a file name instead of a directory, the behaviour of the
function is unspecified and may differ between operating systems and PHP
versions. "

Please advise your preference, I'm happy to raise a bug against the
implementation if required.

------------------------------------------------------------------------

[2007-05-29 11:02:51] tayloj1 at uk dot ibm dot com

OK, then please  - either  -  

(1) fix the function to make Linux implementation behave the same way
as Windows (eg. by adding a check to stop Linux users supplying a
filename). 

- or - 

(2) add the following text (instead of my previous suggestion): 

"Given a file name instead of a directory, the behaviour of the
function is unspecified and may differ between operating systems and PHP
versions. "

Please advise your prefererence, I'm happy to raise a bug against the
implementation if required.

------------------------------------------------------------------------

[2007-05-29 10:35:31] [EMAIL PROTECTED]

Is there any reason why both OS's cannot perform in the same manner?

In checking filestat.c (/* $Id: filestat.c,v 1.160 2007/02/26 20:35:41
tony2001 Exp $ */), for OS2, only the first character of the path is
used (char drive = path[0] & 95;).

Linux accepts a full path.
OS2 accepts a full path, but only uses the drive part.
Windows doesn't accept a full path, but could by checking to see if the
supplied path is a file (php_stat() would do that) and if so, chop off
the filename and try that.

Alternatively, only do the chopping part if the original test fails.



------------------------------------------------------------------------

[2007-05-26 13:15:54] [EMAIL PROTECTED]

Verified behavior on Linux machine. I'm not sure if we should document
this, however, because it's not portable at all.

------------------------------------------------------------------------

[2007-05-24 16:22:07] tayloj1 at uk dot ibm dot com

Description:
------------
Linux behaviour of disk_free_space() is not fully documented

ref:  http://uk.php.net/manual/en/function.disk-free-space.php

The description in the PHP manual states: 

"float disk_free_space ( string $directory )
Given a string containing a directory, this function will return the
number of bytes available on the corresponding filesystem or disk
partition.  "

This is true for Windows, where only a directory name is accepted as
input.  On a Linux system, the function will also accept an existing
filename. 

Please add following text to the description:

"On a Linux system, the function will also accept an existing filename,
in which case it will return the number of bytes remaining in the
corresponding filesystem. "

Example: 

<?php
    // On Linux :
    disk_free_space("/phpwork/tmp.txt") ;      
    //  returns bytes free in filesystem containing tmp.txt 
?>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41493&edit=1

Reply via email to