PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP_WebDAV_Client » Bug #6407

stream_read(): Range one byte too long

Details

Submitted2006-01-03 17:16 UTC
Fromknight_k at gmx dot de
Assignedhholzgra
StatusClosed
PackageHTTP_WebDAV_Client
PHP VersionIrrelevant
OSWinXP
Roadmaps(Not assigned)

Comments

[2006-01-03 17:16 UTC] knight_k at gmx dot de

Description:
------------
Php gives a warning (see below), that one byte too much is read (which actually is, i think)

That's because of the following lines in stream_read($count):
$end = $start+$count;
[...]
$req->addHeader("Range", "bytes=$start-$end");

because of "Range" including the $start-offset, it is one byte too long, so it should be
$end = $start+$count-1;
to fix this.

Test script:
---------------
require_once('HTTP/WebDAV/Client.php');
copy("webdav://webdavserver.net/foo.bar","foo.bar");

Actual result:
--------------
the warning:
"PHP Warning: copy(): HTTP_WebDAV_Client_Stream::stream_read - read 1 bytes more data than requested (8193 read, 8192 max) - excess data will be lost [...]"

and a corrupted file