From:             excalibur at hub dot org
Operating system: FreeBSD 4.8-RC
PHP version:      4.3.1
PHP Bug Type:     Filesystem function related
Bug description:  file function fails to open relative file names...

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 bug report at http://bugs.php.net/?id=22858&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22858&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22858&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22858&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22858&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22858&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22858&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22858&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22858&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22858&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22858&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22858&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22858&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22858&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22858&r=gnused

Reply via email to