php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #31115 fstat() returns array with both associative & numeric indexes
Submitted: 2004-12-16 11:11 UTC Modified: 2004-12-20 10:35 UTC
From: tony2001 at phpclub dot net Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5CVS-2004-12-16 (dev) OS: Linux
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: tony2001 at phpclub dot net
New email:
PHP Version: OS:

 

 [2004-12-16 11:11 UTC] tony2001 at phpclub dot net
Description:
------------
fstat() returns result array with both associative & numerics indexes, but documentation says only about associative ones.

Reproduce code:
---------------
<?php
$fp = fopen(__FILE__,'r');
var_dump(fstat($fp));
?>

Expected result:
----------------
Array
(
    [dev] => 771
    [ino] => 488704
    [mode] => 33188
    [nlink] => 1
    [uid] => 0
    [gid] => 0
    [rdev] => 0
    [size] => 1114
    [atime] => 1061067181
    [mtime] => 1056136526
    [ctime] => 1056136526
    [blksize] => 4096
    [blocks] => 8
)

Actual result:
--------------
array(26) {
  [0]=>
  int(773)
  [1]=>
  int(115763)
  [2]=>
  int(33188)
  [3]=>
  int(1)
  [4]=>
  int(0)
  [5]=>
  int(0)
  [6]=>
  int(0)
  [7]=>
  int(77)
  [8]=>
  int(1103191522)
  [9]=>
  int(1103191522)
  [10]=>
  int(1103191522)
  [11]=>
  int(4096)
  [12]=>
  int(8)
  ["dev"]=>
  int(773)
  ["ino"]=>
  int(115763)
  ["mode"]=>
  int(33188)
  ["nlink"]=>
  int(1)
  ["uid"]=>
  int(0)
  ["gid"]=>
  int(0)
  ["rdev"]=>
  int(0)
  ["size"]=>
  int(77)
  ["atime"]=>
  int(1103191522)
  ["mtime"]=>
  int(1103191522)
  ["ctime"]=>
  int(1103191522)
  ["blksize"]=>
  int(4096)
  ["blocks"]=>
  int(8)
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-20 03:23 UTC] didou@php.net
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

the example have a comment just before the print_r :

// print only the associative part
print_r(array_slice($fstat, 13));

plus the docs clearly tells you to see scan() docs for the output format, and the numeric indexes are described there.

not enough coffee ? :)
 [2004-12-20 10:35 UTC] tony2001 at phpclub dot net
Uh. Yeah, I need coffee, that's definitely true =)
Thanks, Mehdi.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 07 10:01:31 2024 UTC