php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5708 fopen claims file does not exist after first couple uses.
Submitted: 2000-07-20 21:46 UTC Modified: 2001-09-09 14:16 UTC
From: mark at peak-comm dot com Assigned:
Status: Not a bug Package: Misbehaving function
PHP Version: 3.0.16 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: mark at peak-comm dot com
New email:
PHP Version: OS:

 

 [2000-07-20 21:46 UTC] mark at peak-comm dot com
I'm opening up a series of files with fopen, and reading them into an array using fgets.  After reading the first couple files in succesfully, fopen falsly reports that further files do not exist.

Each of the failures echoes the $filename, if I take that URL and pull it up in a web browser, it retrieves the file.

This is all in a loop that generates the filename variables.

for (....... {

  $filename = "http://host.domain.com/" . $year . "/" . $months $month] . "/" . $day . "/" . "$query[$ws]" . ".txt";
  $fd = @fopen($filename,"r"); 
  if (!$fd) { 
    print "Unable to open file: $filename" . "<br>";
    $ws++;
    continue;
  }
  while (!feof($fd)) {
    $data[] = fgets($fd, 4096);
  }
  fclose ($fd);


....... } 

So what I end up with is proper information for the first file or two, the rest of the files fail regaurdless of whether they exist or not.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-09 09:34 UTC] sterling@php.net
I highly doubt this is truly a PHP bug, if you can find a
test case that can always be reproduced, please open a new
bug report.
 [2001-09-09 14:16 UTC] mark at peak-comm dot com
After upgrading to php 4, this problem disapeared.  But it is still reproducable on any of my servers still running 3.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 19 03:01:24 2020 UTC