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
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:
MUST BE VALID
Solve the problem:
29 - 5 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 15:01:28 2024 UTC