#29959 [Opn]: Resource returned by fopen has type 'stream'
| From: | derick@php.net | Date: | Fri, 03 Sep 2004 17:33:59 +0000 |
| Subject: | #29959 [Opn]: Resource returned by fopen has type 'stream' | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969363780@lists.php.net to get a copy of this message | ||
ID: 29959
Updated by: derick@php.net
Reported By: mccarthy36 at earthlink dot net
Status: Open
-Bug Type: Filesystem function related
+Bug Type: Documentation problem
Operating System: Linux
PHP Version: 4.3.8
New Comment:
Let's make it a documentation problem then, because that's what this
is.
Previous Comments:
------------------------------------------------------------------------
[2004-09-03 17:11:58] 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 04:39:04] 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 00:03:46] 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().
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29959&edit=1