php.net |  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
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: lumberjakel at hotmail dot com
New email:
PHP Version: OS:

 

 [2001-08-16 19:19 UTC] lumberjakel at hotmail dot com
Look at the following script-file:

<html><body>
<?php
$fp1=fopen("project1.txt", "r");
fpassthru($fp1);
?>
<br>
some text
<br>
<?php
fpassthru($fp1);
?>
</body></html>

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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-17 01:17 UTC] derick@php.net
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-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC