#22858 [Opn->Fbk]: file function fails to open relative file names...
| From: | iliaa@php.net | Date: | Mon, 24 Mar 2003 23:37:06 +0000 |
| Subject: | #22858 [Opn->Fbk]: file function fails to open relative file names... | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-36339@lists.php.net to get a copy of this message | ||
ID: 22858
Updated by: iliaa@php.net
Reported By: excalibur at hub dot org
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: FreeBSD 4.8-RC
PHP Version: 4.3.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2003-03-24 14:38:34] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22858&edit=1