Home » HTTP » HTTP_Request » Bug #4543
Function _readChunked gives errors when magic_quotes are on
Details
| Submitted | 2005-06-07 11:18 UTC |
|---|---|
| From | Steven at offstage dot be |
| Assigned | avb |
| Status | Closed |
| Package | HTTP_Request |
| PHP Version | 4.3.11 |
| OS | Gentoo Linux - Kernel 2.6.9 |
| Roadmaps | (Not assigned) |
Comments
[2005-06-07 11:18 UTC] Steven at offstage dot be
Description:
------------
Situation:
- magic_quotes_gpc/runtime are OFF in php.ini
- magic_quotes_runtime is ON in php-script
When I get a XML file from a URL with the code below, I get an error (see below)
actual error is in pear/HTTP/Request.php function _readChunked: $this->_chunkLength -= strlen($data);
With the slashes added, strlen(data) is larger than _chunkLength giving a negative value.
Reproduce code:
---------------
$Parser = &new HTTP_Request($file);
$Parser->sendRequest();
$xml_body = $Parser->getResponseBody();
quickfix for Request.php: (+/- line 1119)
---
$data = $this->_sock->read($this->_chunkLength);
$this->_chunkLength -= strlen($data);
//Added by Steven - 20050607
if ($this->_chunkLength < 0) $this->_chunkLength = 0;
if (0 == $this->_chunkLength) {
$this->_sock->readLine(); // Trailing CRLF
}
Expected result:
----------------
Valid XML structure
Actual result:
--------------
time : 2005-06-07 13:05:23
error type : Warning
error msg : fread(): Length parameter must be greater than 0.
file : /home/www/powercity/www/inc/pear/Net/Socket.php
line num : 274