|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12801 scope of opened files
Submitted: 2001-08-16 19:19 UTC Modified: 2001-08-17 06:10 UTC
From: lumberjakel at hotmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.6 OS: win98
Private report: No CVE-ID: None
 [2001-08-16 19:19 UTC] lumberjakel at hotmail dot com
Look at the following script-file:

$fp1=fopen("project1.txt", "r");
some text

You should get twice the content op project1.txt, seperated by "some text", but I get this:

contents of project1.txt
some text 

Warning: 1 is not a valid File-Handle resource in e:\documenten\scripts\test area\project11.php on line 10


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-17 01:17 UTC]
This is intended. The filehandle is closed after the passthru() call.
You need to reopen it. From the manual:

 The file pointer must be valid, and must point to a file successfully opened by fopen(), popen(), or fsockopen(). The file is closed when fpassthru() is done reading it (leaving fp useless).
 [2001-08-17 06:10 UTC] lumberjakel at hotmail dot com
thnx a great deal
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 17 10:05:45 2022 UTC