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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC