ID:          43519
 Updated by:  [EMAIL PROTECTED]
 Reported By: ross dot lawley at gmail dot com
-Status:      Open
+Status:      Closed
 Bug Type:    Streams related
 PHP Version: 5.2.5
 New Comment:

Duplicate, see http://bugs.php.net/43510


Previous Comments:
------------------------------------------------------------------------

[2007-12-06 17:10:42] dz at bitxtender dot com

As with the other bug report that was closed as bogus, the reproduce 
code of course has to be:

$meta = stream_get_meta_data(fopen('http://www.google.com/', 'r'));
var_dump($meta['mode']);

The simple reason why this must work is because one might want to 
serialize an object with a file pointer, and that can only be done by 
grabbing the meta data on sleep, and restoring the stream on wakeup.
But 
fopen() on an HTTP resource with r+ gives a warning that the stream
does 
not support writing.

------------------------------------------------------------------------

[2007-12-06 14:26:25] ross dot lawley at gmail dot com

Description:
------------
When an fopen() is done on an HTTP URL with mode "r", the 
stream_get_meta_data() result returns "r+"

Please reopen #43510 and close this bug because:

The mode parameter specifies the type of access you have to the
stream!

r > Open for reading only; place the file pointer at the beginning of
the file.
r+ > Open for reading and writing; place the file pointer at the
beginning of the file.

Its in the documentation the meta information *should* report the mode
it was opened with so that you can know what you access is to the stream
data, it might be handled elsewhere and not being able to rely on the
meta data is a BUG

Reproduce code:
---------------
$f = fopen('http://www.google.com/', 'r');
var_dump(stream_get_meta_data($f['mode']));

Expected result:
----------------
string 'r' (length=1)

Actual result:
--------------
string 'r+' (length=2)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43519&edit=1

Reply via email to