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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Apr 02 07:01:31 2025 UTC