|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23424 fstat() returns different result
Submitted: 2003-04-30 00:16 UTC Modified: 2003-04-30 04:22 UTC
From: yiwakiri at st dot rim dot or dot jp Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.1 OS:
Private report: No CVE-ID: None
 [2003-04-30 00:16 UTC] yiwakiri at st dot rim dot or dot jp

fstat() returns different results, in PIPE and REDIRECT.

I wrote Following script as both PIPE and REDIRECT

  $stat = fstat(STDIN);
  if ($stat['size'] > 0) {
    echo fread(STDIN, $stat['size']);
  else {
    echo "STDIN is empty.\n";

$ cat sample.php | php sample.php
In this case, The result was a disappointment.

$ php sample.php < sample.php
In this case, I obtained satisfactory results.

fstat() result is diffrent.
  $stat['size'] = 0 // at any time
  $stat['size'] = `actual size'

Is this specifications ?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-30 04:22 UTC]
Pipes/FIFOs have neither a size nor can they been seeked.
This is expected behaviour; not a bug in PHP so marking it as bogus.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jan 24 00:01:23 2021 UTC