php.net |  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
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: yiwakiri at st dot rim dot or dot jp
New email:
PHP Version: OS:

 

 [2003-04-30 00:16 UTC] yiwakiri at st dot rim dot or dot jp
Hi,

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

I wrote Following script as both PIPE and REDIRECT

sample.php:
<?PHP
  $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.
For PIPE,
  $stat['size'] = 0 // at any time
For REDIRECT
  $stat['size'] = `actual size'

Is this specifications ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-30 04:22 UTC] wez@php.net
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 Aug 10 02:01:24 2020 UTC