From:             andrew dot minerd at sellingsource dot com
Operating system: Gentoo
PHP version:      5.2.4RC1
PHP Bug Type:     Streams related
Bug description:  stream_copy_to_stream returns invalid values for memmapped 
streams

Description:
------------
When copying from a memmapped stream, stream_copy_to_stream returns the
length of the memory-mapped segment, regardless of how much data was
actually written to the recipient stream.


Reproduce code:
---------------
<?php
class DummyWriteStream
{
        function stream_open($path, $mode, $options, &$opened_path) { return
TRUE; }
        function stream_write($data) { return 0; }
}

stream_wrapper_register('test2', 'DummyWriteStream');

$fp1 = fopen('/etc/hosts', 'r');
$fp2 = fopen('test2://test', 'w');

var_dump(stream_copy_to_stream($fp1, $fp2, 8192));
?>

Expected result:
----------------
int(0)

Actual result:
--------------
int(1228)

-- 
Edit bug report at http://bugs.php.net/?id=42237&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42237&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42237&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42237&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42237&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42237&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42237&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42237&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42237&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42237&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42237&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42237&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42237&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42237&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42237&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42237&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42237&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42237&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42237&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42237&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42237&r=mysqlcfg

Reply via email to