|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 + 42 = ?
Subscribe to this entry?

 [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-2020 The PHP Group
All rights reserved.
Last updated: Mon Sep 21 17:01:23 2020 UTC