#3895 [Opn->Bgs]: fopen / multiple files
| From: | hholzgra@php.net | Date: | Tue, 01 Oct 2002 01:04:11 +0000 |
| Subject: | #3895 [Opn->Bgs]: fopen / multiple files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-20851@lists.php.net to get a copy of this message | ||
ID: 3895
Updated by: hholzgra@php.net
Reported By: c.lukas@eit.de
-Status: Open
+Status: Bogus
Bug Type: Other
Operating System: linux
PHP Version: 3.0.14
New Comment:
you have to use "or" instead of "||" here
the || resulted in 1 for both assigments
and just by chance the first fopen also
returned resource id 1, while the second
returned 2, so first handle works but
second fails as resource id 1 is already closed
Previous Comments:
------------------------------------------------------------------------
[2000-03-22 09:31:56] c.lukas@eit.de
using the following lines of code:
$fd=fopen("$file1","r") || die ("Internal Error\n");
$content=fread($fd,filesize($file1));
echo "$content</br>";
fclose("$fd");
$fh=fopen("$file2","r") || die ("Internal Error\n");
11 $content=fread($fh,filesize($file2));
echo "$content</br>";
13 fclose($fh);
results in:
Text from file1
Warning: Unable to find file identifier 1 in
/usr/local/htdocs/test.php3 on line 11
Warning: Unable to find file identifier 1 in
/usr/local/htdocs/test.php3 on line 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=3895&edit=1