PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTTP » HTTP_Request » Bug #9374

Incorrect work HTTP_Request::_readChunked()

Details

Submitted2006-11-18 08:43 UTC
Frombalancer at balancer dot ru
StatusBogus
PackageHTTP_Request
PHP Version5.1.6
OSGentoo Linux
Roadmaps(Not assigned)

Comments

[2006-11-18 08:43 UTC] balancer at balancer dot ru

Description:
------------
Function _readChunked() using function strlen() for get chunked string size. It's incorrect for unicode system.

Test script:
---------------
<xmp><?php
require_once "HTTP/Request.php";

$req = &new HTTP_Request("http://control.renter.ru/ipstat/");
$req->addHeader("Accept-Charset", 'UTF-8');
$req->addHeader("Accept-Encoding", 'none');

$resp = $req->sendRequest();

if (!PEAR::isError($resp))
$resp = $req->getResponseBody();
else
$resp = $resp->getMessage();

echo "resp=".$resp;
?></xmp>

Expected result:
----------------
Full html page.

Actual result:
--------------
Truncated HTML page.

If change HTTP/Requset.php:1176

from

$this->_chunkLength -= strlen($data);

to

$this->_chunkLength -= strlen($data) - 1;

then page downloaded full.

Need to change from strlen($data) to function returns really byte-length (not char-length).