php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22858 file function fails to open relative file names...
Submitted: 2003-03-24 14:38 UTC Modified: 2003-03-31 18:13 UTC
From: excalibur at hub dot org Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.3.1 OS: FreeBSD 4.8-RC
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: excalibur at hub dot org
New email:
PHP Version: OS:

 

 [2003-03-24 14:38 UTC] excalibur at hub dot org
Hi Guy's, 


 Got an issue that appears to be related to some other functions but as this one is specific to a function I figured it's due it's own bug posting. Ran into an issue where file() does not open relative file names, for instance:

$words_file = "./config/filter.txt";
if (@is_readable($words_file)) {
 /* Read the file and iterate through the lines. */
 $lines = file($words_file);
 foreach ($lines as $line) {
  print $line."<BR>";
 }
}

 I get:

 Warning: file(./config/filter.txt) [function.file]: failed to create stream: No such file or directory in /usr/local/www/test.com/horde/lib/Text.php on line 41

Warning: Invalid argument supplied for foreach() in /usr/local/www/test.com/horde/lib/Text.php on line 42

 Yet if I specify the full path to the very same file, it works fine:

$words_file = "/usr/local/www/test.com/horde/imp/config/filter.txt";
if (@is_readable($words_file)) {
 /* Read the file and iterate through the lines. */
 $lines = file($words_file);
 foreach ($lines as $line) {
  print $line."<BR>";
 }
}

The is_readable sees the file fine, but file itself fails.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-31 02:00 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-03-31 09:24 UTC] excalibur at hub dot org
Hi Guy's, 

 Sorry I was unavailable for a bit there, at this time I do not have the option of testing with the RC version of PHP. I will see what I can go about finding an alternative area to test this out.
 [2003-03-31 18:13 UTC] sniper@php.net
Works fine using latest stable snapshot.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC