php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7094 fstat() returns an empty array
Submitted: 2000-10-09 01:25 UTC Modified: 2000-10-28 23:54 UTC
From: doc at kadath dot org Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.2 OS: Linux 2.2.17
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: doc at kadath dot org
New email:
PHP Version: OS:

 

 [2000-10-09 01:25 UTC] doc at kadath dot org
I could be wrong, but it appears that fstat($fp) returns an array of nulls instead of an array of file stats. See the following code:

$fp = fopen($filename, "r");
$fstats = fstat($fp);

for($i=0; $i<14; $i++) {
        $len=strlen($fstats[i]);
        echo "fstats $i: $fstats[$i] / len=$len<br>\n";
}

echo "fstat() with bogus pointer: ".fstat($bogusfp);


----------------
This is the output:

fstats 0: / len=0
fstats 1: / len=0
fstats 2: / len=0
fstats 3: / len=0
fstats 4: / len=0
fstats 5: / len=0
fstats 6: / len=0
fstats 7: / len=0
fstats 8: / len=0
fstats 9: / len=0
fstats 10: / len=0
fstats 11: / len=0
fstats 12: / len=0
fstats 13: / len=0

Warning: Supplied argument is not a valid File-Handle resource in /home/mentat/public_html/dom-functions.php on line 23
fstat() with bogus pointer:


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-11 09:55 UTC] stas@php.net
Cannot reproduce on current CVS.

What was the value of $filename?
What was the $fp (try var_dump($fp))
What is the result of var_dump($fstats) after fstat?
 [2000-10-28 23:54 UTC] sniper@php.net
No feedback, can not reproduce.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC