php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #29959 Resource returned by fopen has type 'stream'
Submitted: 2004-09-03 00:03 UTC Modified: 2004-09-06 20:52 UTC
From: mccarthy36 at earthlink dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.8 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mccarthy36 at earthlink dot net
New email:
PHP Version: OS:

 

 [2004-09-03 00:03 UTC] mccarthy36 at earthlink dot net
Description:
------------
The resource returned by fopen() (when used to open a file) is reported as type 'stream', not 'file'.

I'm not sure if this is a documentation problem or an fopen() problem.  Appendix K doesn't list any functions as returning resources of type 'stream'.  But, as 'stream' seems more generic, from my perspective it seems desirable to have the resource returned by fopen() identified as 'file' as described in the documentation.

Reproduce code:
---------------
$file = fopen( 'file.txt', 'r' );

var_dump( get_resource_type( $file ) );

Expected result:
----------------
Appendix K. List of Resource Types states that 'file' is the type of resource returned by fopen().

Actual result:
--------------
'stream' is reported as the type of the resourced returned by fopen().

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-03 04:39 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is expected. 
 [2004-09-03 17:11 UTC] mccarthy36 at earthlink dot net
Not to be combative, but it's not _expected_ based on what the manual says.
* fopen() returns a resource
* get_resource_type() returns a string representing the type of the resource
* Appendix K gives 'file' as the resource type name created by fopen()

Would you please say specifically which part of the manual I should double-check to better understand the situation?

Thank you
 [2004-09-03 19:33 UTC] derick@php.net
Let's make it a documentation problem then, because that's what this is.
 [2004-09-06 20:52 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=45481d7f3c8af1bdc45d78f76a571d18fa11bde2
Log: fix #29959: stream resource
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 20:01:33 2025 UTC